when you consolidate are you checking both use labels on Row and Column..
I usally write the code to consolidate when needed. I try to post an
example tonight.
Joel,
Using excel 2003, just testing data consolidate for 6 worksheets of 12
months budget with all selection keys (ie row & column headers and
create link to source data) and post the result on new workbook shows
24 months data consolidation but it works fine for data consolidate on
2 or 3 worksheets of 12 months budget with the same selection keys,
now getting no confidence on using excel data consolidate function
Regards
Len
Hi,
I managed to find the same nature of this thread from other forum for
data consolidation by using excel vba and modified the codes to reset
the name range in the worksheet(P+L) e.g. excel file name " ADP.xls"
and name range will be set as "ADP.PL" and this will set the name
range in the worksheet(P+L) for the rest of excel files name with
".PL" , it seems that the codes do not work specially with the
variable "Namerng" & "NameList that do not change when the next file
name is called
At the end, it promts run time error " consolidation reference not
valid "
Can someone help to identify the error of the codes below and rectify
them : -
Const MAXBOOK As Long = 50
Dim i%, SheetArg$()
Dim sPath1 As String
ReDim SheetArg(1 To MAXBOOK)
Dim x As String
Dim Namerng As Variant, NameList As Variant
Dim sPath As String, sFile As String
ThisWorkbook.Worksheets("SumTotal") _
.Cells.ClearContents
sPath = "J:\BBT\LO\Budget\Budget Actual\Acad\"
i = 0
sPath1 = "J:\BBT\LO\Budget\Budget Actual\Acad\*.xls"
sFile = Dir(sPath1)
NameList = Left(sFile, InStrRev(sFile, ".") - 1)
x = ".PL"
Namerng = NameList & x
Do While sFile <> ""
i = i + 1
SheetArg(i) = "'" & sPath & _
"[" & sFile & "]P+L'! Namerng "
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:=True, _
LeftColumn:=True, _
CreateLinks:=True
Thanks in advance
Regards
Len