Panthers0027
Board Regular
- Joined
- Apr 13, 2009
- Messages
- 89
Here's a tricky one:
I have one Master Sheet that fetches information off of 30 other workbooks. The data is uniform accross all workbooks.
As of right now, I have code written that will update the master, but ONLY if the other workbooks are open.
Is it possbile to get the same data off of closed workbooks?
Here's what I'm using now:
Variable "List" is the list of Workbook names that I'm using.
The code "Windows(List).Activate" is what I'm using to get the data from the other workbooks, but this only works when the workbooks are open
What can I replace this code with?
It may not even be possible, but I figured if anyone can figure it out, it's the geniuses on here!
Thanks,
Andre
- I'm using Windows XP and Office 2003
I have one Master Sheet that fetches information off of 30 other workbooks. The data is uniform accross all workbooks.
As of right now, I have code written that will update the master, but ONLY if the other workbooks are open.
Is it possbile to get the same data off of closed workbooks?
Here's what I'm using now:
Code:
Sub Master()
Windows("Master.xls").Activate
Dim Reps As Integer
Reps = Range("Reps").Column
Dim LastColumn As Long
LastColumn = Cells(1, Columns.Count).End(xlToLeft).Column
Range(Cells(3, 1), Cells(50000, LastColumn)).ClearContents
Dim LastRepRow As Long
LastRepRow = Cells(Rows.Count, Reps).End(xlUp).Row
Dim i As Integer
For i = 3 To LastRepRow
Dim List As String
List = Cells(i, Reps)
[B]Windows(List).Activate[/B]
Dim LastContact As Long
LastContact = Cells(Rows.Count, 2).End(xlUp).End(xlUp).Row
Range(Cells(3, 2), Cells(LastContact, LastColumn)).Copy
Windows("Master.xls").Activate
Dim LastMasterContact As Long
LastMasterContact = Cells(Rows.Count, 2).End(xlUp).End(xlUp).Row + 1
Range("B" & LastMasterContact).Select
Application.Run "PERSONAL2.xls!Paste_Values"
Dim LastMasterContact2 As Long
LastMasterContact2 = Cells(Rows.Count, 2).End(xlUp).End(xlUp).Row
Range("A" & LastMasterContact).Value = List
Range("A" & LastMasterContact).AutoFill Range("A" & LastMasterContact & ":" & "A" & LastMasterContact2)
Next i
Columns("A").Replace What:=" Contacts.xls", Replacement:=""
End Sub
Variable "List" is the list of Workbook names that I'm using.
The code "Windows(List).Activate" is what I'm using to get the data from the other workbooks, but this only works when the workbooks are open
What can I replace this code with?
It may not even be possible, but I figured if anyone can figure it out, it's the geniuses on here!
Thanks,
Andre
- I'm using Windows XP and Office 2003