Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Consolidation across workbooks janmd Excel Discussion (Misc queries) 0 August 29th 09 09:00 AM
Data Consolidation w/ Multiple List Boxes Gayla Excel Worksheet Functions 2 April 2nd 07 07:44 PM
Data consolidation from Multiple Sheets wingale Excel Worksheet Functions 1 April 14th 06 05:25 PM
Multiple Consolidation Ranges Matt Cromer Excel Discussion (Misc queries) 0 December 1st 05 09:51 PM
Multiple Consolidation Ranges nc Excel Discussion (Misc queries) 2 April 26th 05 10:24 AM


All times are GMT +1. The time now is 08:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"