Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
loop through workbooks
Try this example
http://www.rondebruin.nl/copy3.htm Post back if you need help -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Rhonda" wrote in message ... I need a macro to loop through a directory (C:\MyDocuments) and identify files with the .bak extension. Then open them one at a time because I need to copy columns to a master. I found this macro, can it be changed to my needs? Sub WorksheetLoop() Dim WS_Count As Integer Dim I As Integer ' Set WS_Count equal to the number of worksheets in the active ' workbook. WS_Count = ActiveWorkbook.Worksheets.Count ' Begin the loop. For I = 1 To WS_Count ' Insert your code here. ' The following line shows how to reference a sheet within ' the loop by displaying the worksheet name in a dialog box. MsgBox ActiveWorkbook.Worksheets(I).Name Next I End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find loop doesn't loop | Excel Discussion (Misc queries) | |||
Copy/ move selected data from workbooks to seperate worksheets or workbooks | Excel Worksheet Functions | |||
Loop through folder of workbooks and add rows | Excel Worksheet Functions | |||
Display 2 formulas from source workbooks to destination workbooks | Excel Discussion (Misc queries) | |||
Can I have a loop to open a set of workbooks get some data, close it one a time. | Excel Programming |