Get sheet name in any workbook

  • Thread starter Thread starter OffDev
  • Start date Start date
O

OffDev

Hello,

I would like to get the name of the first sheet in any workbook that an user
chooses.
Is this possible?
I've tried wb.sheets(1).name. Doesn't work.

Please assist.
Thanks
 
Here is one way right out of VBA help file.

For Each sh In Workbooks("BOOK1.XLS").Windows(1).SelectedSheets
If sh.Name = "Sheet1" Then
MsgBox "Sheet1 is selected"
Exit For
End If
Next


You can also try: ActiveSheet.Name
 
Back
Top