Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
|
|||
|
|||
Need help data consolidation multiple workbooks
Tom Ogilvy was gracious enough to post the following piece of code
which I can modify to do pretty much what I want. However, I would prefer to actually open each workbook using the "getopenfilename multiselect=true method" as I need to perform some other actions on the files before consolidating them. Since I haven't dealt much with arrays I'm a bit confused about how to modify the pieces of code that have to do with the array. Following is the piece of code. Would appreciate any input. Thank you!: Sub Totals() Const MAXBOOK As Long = 20 Dim i%, SheetArg$() Dim sPath1 As String ReDim SheetArg(1 To MAXBOOK) Dim sPath As String, sFile As String ThisWorkbook.Worksheets("SumTotal") _ .Cells.ClearContents sPath = "D:\Timelist\Data\" i = 0 sPath1 = "D:\TimeList\Data\*.xls" sFile = Dir(sPath1) Do While sFile < "" i = i + 1 SheetArg(i) = "'" & sPath & _ "[" & sFile & "]Total'!R1C2:R16384C3" sFile = Dir() Loop ' For i = 1 To MAXBOOK ' Debug.Print i, SheetArg(i) ' Next ThisWorkbook.Sheets("SumTotal"). _ Range("A1").Consolidate _ Sources:=Array(SheetArg), _ Function:=xlSum, _ TopRow:=False, _ LeftColumn:=False, _ CreateLinks:=False End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Data Consolidation across workbooks | Excel Discussion (Misc queries) | |||
Data Consolidation w/ Multiple List Boxes | Excel Worksheet Functions | |||
Data consolidation from Multiple Sheets | Excel Worksheet Functions | |||
Multiple Consolidation Ranges | Excel Discussion (Misc queries) | |||
Multiple Consolidation Ranges | Excel Discussion (Misc queries) |