Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to Cycle through open workbooks
How do I cycle through the open workbooks and perform a vba script on each
one? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to Cycle through open workbooks
See the sample For Each-Next loop below:
Sub cycle() Dim a As Object For Each a In Workbooks 'do whatever you want to do here a.Worksheets(1).Range("A1").Value = 1 Next End Sub "Buster" wrote: How do I cycle through the open workbooks and perform a vba script on each one? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to Cycle through open workbooks
Dim a As Object
Better to declare 'a' As Workbook since the Workbooks collection contains only Workbooks. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Edwin Tam" wrote in message ... See the sample For Each-Next loop below: Sub cycle() Dim a As Object For Each a In Workbooks 'do whatever you want to do here a.Worksheets(1).Range("A1").Value = 1 Next End Sub "Buster" wrote: How do I cycle through the open workbooks and perform a vba script on each one? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I keep result from 1 iteration cycle to use in next cycle? | Excel Discussion (Misc queries) | |||
When I open Excel, workbooks open automatically. How can I stop t | Excel Discussion (Misc queries) | |||
How do I cycle through all of the open worksheets? | Excel Discussion (Misc queries) | |||
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed | Excel Programming | |||
Workbooks.Open / .Open Text - How do you stop the .xls addition? | Excel Programming |