ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get sheet name in any workbook (https://www.excelbanter.com/excel-programming/436900-get-sheet-name-any-workbook.html)

OffDev

Get sheet name in any workbook
 
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

JLGWhiz[_2_]

Get sheet name in any workbook
 
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


"OffDev" wrote in message
...
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





All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com