Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello- I'm building a macro to go through a list of file names; for any .xls files in that list, I want to create a list of the worksheets in that file. I want to create this new list in the "master" file that stores the macro. I would prefer if I could keep the focus on the "master" sheet, and pull in the names from the open, but inactive, .xls file. The code below is my attempt to do that, but I get a "Subscript out of range (Error 9)". I'm open to other solutions that have the end result of putting a list of tab names on the master sheet without altering any content in the other .xls files. I also tried keeping the focus on the .xls file and sending the results to the inactive master sheet, but that didn't fare any better. Thank you all, these boards are incredibly helpful to those people like me who get in over their heads with random Excel projects :) My code: Do Until HRow = GRow Windows("Info Delivery Version 2.xls").Activate ***The "Master Sheet" Sheets("Sheet1").Activate FileName = Range("C" & HRow) FileType = Range("D" & HRow) If FileType < ".zip" Then Application.EnableEvents = False Workbooks.Open FileName:=Path & FileName End If Windows("Info Delivery Version 2.xls").Activate Sheets("Sheet1").Activate If FileType = ".xls" Then Dim WS As Worksheet For Each WS In Windows("FileName").Sheets ***Here's where I get an error Range("G" & IRow) = FileName Range("H" & IRow) = WS.Name IRow = IRow + 1 Next ElseIf FileType < ".zip" Then Range("G" & IRow) = Range("C" & HRow) IRow = IRow + 1 End If HRow = HRow + 1 Loop |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
XL 2007: can't change Inactive Excel Add ins to Active (DLL Com Addin as Visible) | Excel Programming | |||
Average IF? A1:A1000 has numbers - B1:B1000 has Active or Inactive | Excel Discussion (Misc queries) | |||
How can I have formatting options like merge cells ,Bold,active for the unlocked cells of the protected worksheet.Is it possible in excel? | Excel Programming | |||
Excel should indicate a list of inactive names | Excel Discussion (Misc queries) | |||
Multiselect ListBox - Active/Inactive Items | Excel Programming |