Trevor G
Registered User.
- Local time
- Today, 23:29
- Joined
- Oct 1, 2009
- Messages
- 2,361
I have created a consolidation option to open multiple books and I have recorded this option within Excel 2007. It works great but I would like to select the workbooks when I need them, rather than the ones indicated. So I believe I should refer them in an array but not sure how to amend the code. Any advice would be welcome.
The folder path indicated is an example but will change, but the workbooks will come from the same folder location.
The folder path indicated is an example but will change, but the workbooks will come from the same folder location.
Sub mcrConsolidate()
'
' mcrConsolidate Macro
'
'
Range("A2").Select
Selection.Consolidate Sources:=Array( _
"'C:\Access VBA Practice\Consolidate1.xls'!R2C1:R5C3", _
"'C:\Access VBA Practice\Consolidate2.xls'!R2C1:R5C3", _
"'C:\Access VBA Practice\Consolidate3.xls'!R2C1:R5C3"), Function:=xlSum, _
TopRow:=True, LeftColumn:=True, CreateLinks:=False
End Sub