This post https://stackoverflow.com/a/65020762/4928763 describes referring to a worksheet using its codename like this...
With Sheet1
.[a1] = Sheet1.Name
End With
and... .CodeName as Sheet3 in Sheet3.Range("A1")
so I would expect to be able to activate a sheet using...
With Sheet1
.activate
End With
or even just using...
Sheet3.activate
but when trying this I get a compile error: Variable not defined What am I doing wrong?
Just to be clear - In my case the sheet has Sheet.Name = "Monthly Sales" and Sheet.Codename = "wsMonthlySales" and in the project exporer the name is displayed as wsMonthlySales (Monthly Sales)
I can activate the sheet using Sheets("Monthly Sales").Activate
but I would like to use something like wsMonthlySales.Activate
as descrived above but get "Variable not defined" error when trying to compile