ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop through all Open workbooks (https://www.excelbanter.com/excel-programming/300652-loop-through-all-open-workbooks.html)

Stuart[_5_]

Loop through all Open workbooks
 
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.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.700 / Virus Database: 457 - Release Date: 06/06/2004



Ken Macksey

Loop through all Open workbooks
 
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


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.692 / Virus Database: 453 - Release Date: 28/05/2004



Don Guillett[_4_]

Loop through all Open workbooks
 
Sub allwbs()
For Each wb In Workbooks
MsgBox wb.Name

Next
End Sub

--
Don Guillett
SalesAid Software

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


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.700 / Virus Database: 457 - Release Date: 06/06/2004





Stuart[_5_]

Loop through all Open workbooks
 
Many thanks to you both.
Doubly brain drained today.
Regards.

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


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.692 / Virus Database: 453 - Release Date: 28/05/2004




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.700 / Virus Database: 457 - Release Date: 06/06/2004




All times are GMT +1. The time now is 01:47 AM.

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