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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top