Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Consolidate Sources

Hi,

My workbook consists of 10 sheets. The names of the sheets a Total,
Jan03, Feb03, Mar03, Apr03, May03, Jun03, Jul03, Aug03 and List. The
workbook will expand with a new sheet each new month (Oct03, Nov03,
Des03, Jan04....)

The sheet named Total is used to consolidate the range B2:C65536 in
all sheets, but not the sheet named List. By today my code look like:

Sub Makro1()
'
Sheets("Total").Select
Range("B2").Select
Selection.Consolidate Sources:=Array( _
"'C:\Documents and Settings\[Bok2.xls]Apr03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Aug03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Feb03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Jan03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Jul03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Jun03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Mar03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]May03'!R2C2:R65536C3") _
, Function:=xlSum, TopRow:=False, LeftColumn:=True,
CreateLinks:=False
End Sub

I don't know much about Array functions, but isn't there an easy way
to make a code that will consolidate all sheets in the workbook except
those two named Total and List?

Any help would be much appreciated.

Regards,
Paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Consolidate Sources

why not a dummy sheet after the last inserted sheet and
=sum(sheet1:last!b1) where b1 has the total for b2:c65536

"Paul" wrote in message
om...
Hi,

My workbook consists of 10 sheets. The names of the sheets a Total,
Jan03, Feb03, Mar03, Apr03, May03, Jun03, Jul03, Aug03 and List. The
workbook will expand with a new sheet each new month (Oct03, Nov03,
Des03, Jan04....)

The sheet named Total is used to consolidate the range B2:C65536 in
all sheets, but not the sheet named List. By today my code look like:

Sub Makro1()
'
Sheets("Total").Select
Range("B2").Select
Selection.Consolidate Sources:=Array( _
"'C:\Documents and Settings\[Bok2.xls]Apr03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Aug03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Feb03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Jan03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Jul03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Jun03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Mar03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]May03'!R2C2:R65536C3") _
, Function:=xlSum, TopRow:=False, LeftColumn:=True,
CreateLinks:=False
End Sub

I don't know much about Array functions, but isn't there an easy way
to make a code that will consolidate all sheets in the workbook except
those two named Total and List?

Any help would be much appreciated.

Regards,
Paul



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Consolidate Sources

Try this:

Sub Totals()
Dim i%, SheetArg$()
ReDim SheetArg(2 To Worksheets.Count-1)
For i = 2 To Worksheets.Count-1
SheetArg(i) = Worksheets(i).Name & "!R2C2:R65536C3"
Next i
Sheets("Total").Select
Range("B2").Select
Worksheets("Sheet1").Range("A1").Consolidate _
Sources:=Array(SheetArg), _
Function:=xlSum
End Sub

"Paul" wrote in message
om...
Hi,

My workbook consists of 10 sheets. The names of the sheets a Total,
Jan03, Feb03, Mar03, Apr03, May03, Jun03, Jul03, Aug03 and List. The
workbook will expand with a new sheet each new month (Oct03, Nov03,
Des03, Jan04....)

The sheet named Total is used to consolidate the range B2:C65536 in
all sheets, but not the sheet named List. By today my code look like:

Sub Makro1()
'
Sheets("Total").Select
Range("B2").Select
Selection.Consolidate Sources:=Array( _
"'C:\Documents and Settings\[Bok2.xls]Apr03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Aug03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Feb03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Jan03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Jul03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Jun03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]Mar03'!R2C2:R65536C3", _
"'C:\Documents and Settings\[Bok2.xls]May03'!R2C2:R65536C3") _
, Function:=xlSum, TopRow:=False, LeftColumn:=True,
CreateLinks:=False
End Sub

I don't know much about Array functions, but isn't there an easy way
to make a code that will consolidate all sheets in the workbook except
those two named Total and List?

Any help would be much appreciated.

Regards,
Paul



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
PLEASE HELP! Return a Value Using Multiple Sources eed Excel Discussion (Misc queries) 4 September 22nd 09 02:05 PM
Return a Value Using Multiple Sources eed Excel Discussion (Misc queries) 0 September 15th 09 08:29 PM
Editing sources therd Excel Discussion (Misc queries) 1 August 26th 08 12:45 AM
Comparing Spreadsheets from Different Sources McLovin Excel Worksheet Functions 5 February 29th 08 11:43 PM
Pivottables - Can i consolidate 2 Data sources in Excel 2007? Kevin Clark[_2_] Excel Discussion (Misc queries) 4 January 8th 08 12:32 AM


All times are GMT +1. The time now is 05:35 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"