MsgBox Application.Worksheets(1).Name
MsgBox Application.Sheets(1).Name
Substitute your variable for 1
--
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
"donbowyer" wrote:
| This The expression works OK:-
| Set VBComp = ThisWorkbook.VBProject.VBComponents("Sheet1")
| But what is the correct syntax if I want to refer to a sheet with a
variable
| number?
| Suppose the variable sheet number is MySh, then ("SheetMySh") produces a
| runtime error "Script out of range"
| --
| donwb