Hi all -
I am using Excel 2003 and have a very simple (in theory) macro that is supposed to display the name of the active sheet in a message box:
Public Sub DisplayActiveSheetName()
Dim worksheet1 As Excel.Worksheet
worksheet1 = ThisWorkbook.ActiveSheet
MsgBox ("The name of the active sheet is: " & worksheet1.Name)
End Sub
This code resides in a Module.
When running this code, I receive the Run-time error '91' that the
worksheet1 = ThisWorkbook.ActiveSheet
line "Object Variable or With block variable not set."
Any advice would be appreciated.
Thanks!
Bookmarks