Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure if this is possible but here goes:
I need to be able to look through a column of cells and open each workbook whose name corresponds to the value in each cell one at a time. Example: Column H 931C 941 921B 900B In this example it would look at column H, open 931C.xls, do some "stuff" (including closing the workbook after it's done),open 941.XLS, do its "stuff", open 921B.xls.... The "stuff" I can handle, just have no clue how to loop through the column and open the files like I described. Any help would be GREATLY appreciated. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Todd,
Try something like Dim Rng As Range Dim WB As Workbook For Each Rng In Range("H1:H100") ' << change range as needed If Rng.Value < "" Then Set WB = Workbooks.Open(ThisWorkbook.Path & "\" & Rng.Value & ".xls") ' do something with WB WB.Close SaveChanges:=True End If Next Rng -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Todd" wrote in message ... Not sure if this is possible but here goes: I need to be able to look through a column of cells and open each workbook whose name corresponds to the value in each cell one at a time. Example: Column H 931C 941 921B 900B In this example it would look at column H, open 931C.xls, do some "stuff" (including closing the workbook after it's done),open 941.XLS, do its "stuff", open 921B.xls.... The "stuff" I can handle, just have no clue how to loop through the column and open the files like I described. Any help would be GREATLY appreciated. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Perfect...Thanks a million Chip
-----Original Message----- Todd, Try something like Dim Rng As Range Dim WB As Workbook For Each Rng In Range("H1:H100") ' << change range as needed If Rng.Value < "" Then Set WB = Workbooks.Open(ThisWorkbook.Path & "\" & Rng.Value & ".xls") ' do something with WB WB.Close SaveChanges:=True End If Next Rng -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Todd" wrote in message ... Not sure if this is possible but here goes: I need to be able to look through a column of cells and open each workbook whose name corresponds to the value in each cell one at a time. Example: Column H 931C 941 921B 900B In this example it would look at column H, open 931C.xls, do some "stuff" (including closing the workbook after it's done),open 941.XLS, do its "stuff", open 921B.xls.... The "stuff" I can handle, just have no clue how to loop through the column and open the files like I described. Any help would be GREATLY appreciated. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Finding a Workbook based on a Cell information in another Workbook | Excel Worksheet Functions | |||
opening a link in a workbook cell to edit?? | New Users to Excel | |||
On opening a worksheet move focus to a cell based on date | Excel Worksheet Functions | |||
Active Cell when opening workbook | Excel Worksheet Functions | |||
How to make opening of workbook conditional of opening of another workbook | Excel Programming |