Loop through all Open workbooks

  • Thread starter Thread starter Stuart
  • Start date Start date
S

Stuart

User has opened workbooks - I've no idea as to their names
nor how many.
With ActiveWorkbook will deal with one of them.
How do I get at the others, please?

Regards.
 
Hi

You could do something like

For i = 1 to workbooks.count
workbooks(i).activate
'do whatever you want to the active workbook here
next i

HTH

Ken
 
Sub allwbs()
For Each wb In Workbooks
MsgBox wb.Name

Next
End Sub
 

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