ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   opening and closing files in order with vba (https://www.excelbanter.com/excel-programming/294884-opening-closing-files-order-vba.html)

shane[_2_]

opening and closing files in order with vba
 
I am wanting to open and close a excel file named PS 01-01-98 through PS 01-01-2004 in order and extract data from each file untill I reach the last file. I already have the code written to extract the data, but am not sure how to open the next filename in order. Any help would be greatly appreciated
thanks, shane

Greg Koppel

opening and closing files in order with vba
 
Hi Shane,

myFile = Dir(" path to the first file in the folder... \FirstFile.xls")
Do Until myFile=""
perform the operations on myFile
myFile=Dir() NOTE: Do not include the path to the folder here
Loop

HTH, Greg

"shane" wrote in message
...
I am wanting to open and close a excel file named PS 01-01-98 through PS

01-01-2004 in order and extract data from each file untill I reach the last
file. I already have the code written to extract the data, but am not sure
how to open the next filename in order. Any help would be greatly
appreciated.
thanks, shane





All times are GMT +1. The time now is 05:28 PM.

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