Dim WS As Worksheet
Set WS = Sheets.Add(After:=Sheets(Worksheets.count))
WS.name = txtSheetName.value
Dim WS As Worksheet
MsgBox (WS Is Nothing)
Set WS = Sheets.Add(After:=Sheets(Worksheets.count))
'***** Nothing after this point gets processed *******
MsgBox (WS Is Nothing)
MsgBox WS.name
WS.name = txtSheetName.value
MsgBox WS.name
Dim WS as Worksheet
Set WS = Sheets.Add
You don't have to know where is it located, what's it's name, you just refer to it as WS.
If you still want to do this the "old fashioned" way, try this:
Sheets.Add.Name = "Test"
Dim WS As Worksheet
Dim i As Long
With ThisWorkbook
Set WS = .Worksheets.Add(After:=.Sheets(.Sheets.Count))
End With
For i = 1 To 1000
DoEvents
Next i
WS.Name = txtSheetName.Value