I have a single textbox on a worksheet. When using the actual worksheet name ("Sheet1") the "TextBox1" option is available in intellisense and the code works when the macro is executed. When using a variable name (i.e., "Set ws = Sheet1"), the "TextBox1" option is not available in intellisense and the macro generates an error ("Compile error: Method or data member not found"). Why is the textbox option not available when using the variable name? Thanks in advance for your help.
Dim ws As Worksheet
Dim txt1 As String, txt2 As String
Set ws = Sheet1 txt1 = Sheet1.TextBox1.Value 'no error txt2 = ws.TextBox1.Value 'error Debug.Print "txt1: " & txt1 Debug.Print "txt2: " & txt2