ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do you list all the workbooks you have opened and the sheets in each workbook? (https://www.excelbanter.com/excel-programming/284611-how-do-you-list-all-workbooks-you-have-opened-sheets-each-workbook.html)

Wendy[_3_]

How do you list all the workbooks you have opened and the sheets in each workbook?
 
How do you display a list of open workbooks and each sheet name in that
workbook??

Thanks

wendy



Bob Phillips[_6_]

How do you list all the workbooks you have opened and the sheets in each workbook?
 
Wendy,

Try this

Dim i As Long
Dim wb As Workbook
Dim ws As Worksheet

i = 1
For Each wb In Workbooks
ActiveSheet.Cells(i, 1) = wb.Name
i = i + 1
For Each ws In wb.Worksheets
ActiveSheet.Cells(i, 2) = ws.Name
i = i + 1
Next ws
Next wb


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Wendy" wrote in message
...
How do you display a list of open workbooks and each sheet name in that
workbook??

Thanks

wendy






All times are GMT +1. The time now is 06:42 PM.

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