Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello everyone, All of my workbooks in a directory have the same format. As it stands now, I open each one manually, and have my code extract the data from a sheet and aggregate it on the appropriate sheet of my report file. All I am looking to do is open each workbook, perform my macro, close the work book and open the next. I figure to do this correctly, the macro would have to count the workbooks in the directory (there are 51), and from 1-n, open work book, call my macro, close workbook, next n. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Sub a() Dim wkb As Workbook Dim strPath As String Dim strFile As String strPath = "C:\myfiles\" your path strFile = Dir(strPath & "*.xls") Do While strFile < "" Set wkb = Workbooks.Open(strPath & strFile) 'do your bits wkb.Close savechanges:=True strFile = Dir() Loop MsgBox "done" End Sub regards -- tony h ------------------------------------------------------------------------ tony h's Profile: http://www.excelforum.com/member.php...o&userid=21074 View this thread: http://www.excelforum.com/showthread...hreadid=509000 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thats perfect, thank you very much. -- Btibert ------------------------------------------------------------------------ Btibert's Profile: http://www.excelforum.com/member.php...fo&userid=8559 View this thread: http://www.excelforum.com/showthread...hreadid=509000 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Perform action if value in cell - conditional VB stmt | Excel Discussion (Misc queries) | |||
Compare two sheets and perform action routine | Excel Programming | |||
How to 'Click and then perform action' | Excel Programming | |||
How to perform action in all worksheets | Excel Programming | |||
Perform action when cell is clicked | Excel Programming |