![]() |
Opening Files Using VBA
I have a named range (FilesToOpen) that contains a variable number of
filenames and path (i.e. c:\mydoc\text.xls) that need to be opened (range FileCount contains number of files). What I want to do is have a macro that opens all the files in FilesToOpen range, calculates the original sheet, and then close the files opened by the macro. I've been trying with For and Next and open file Range etc. but am strugling with the syntax. Any help appreciated. Thanks. |
Opening Files Using VBA
Uzytkownik napisal w wiadomosci ups.com... I have a named range (FilesToOpen) that contains a variable number of filenames and path (i.e. c:\mydoc\text.xls) that need to be opened (range FileCount contains number of files). What I want to do is have a macro that opens all the files in FilesToOpen range, calculates the original sheet, and then close the files opened by the macro. I've been trying with For and Next and open file Range etc. but am strugling with the syntax. Any help appreciated. Thanks. Sub test() Dim filename As String For Each cell In Range("a1:a2") filename= "c:\" & cell.Value & ".xls" Workbooks.Open Filename:=filename ..... ... Next filename End Sub hope this help mcg |
All times are GMT +1. The time now is 10:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com