Billy Hill
Board Regular
- Joined
- Dec 21, 2010
- Messages
- 73
I'm trying to get the names of the sheets in an open workbook using the code below. It's not returning the workbook's sheets, it's returning the Personal.XLSB's sheets.
I tried using Thisworkbook.Name and and also returned Personal.XLSB. How do I tell it to use the current workbook's name instead of the workbook that's got the macro?
Thanks in advance.
Code:
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
Debug.Print ws.Name
Next ws
I tried using Thisworkbook.Name and and also returned Personal.XLSB. How do I tell it to use the current workbook's name instead of the workbook that's got the macro?
Thanks in advance.