run one macro after another... NEXT ?

g48dd

Board Regular
Joined
Jan 12, 2009
Messages
101
Hi I am using 2003, I am using the consolidate tool to consolidate data on 31 different sheets in the same work book. The consolidate tool will only take 11 sheets at a time, so I have to do 1-11, 12-21, 22-31 and the run consolidate again but this time I am consolidating the results of the first three to get 1 table. Here is the first macro:
Code:
Option Explicit

Sub Con_Month()
'
' Con_Month Macro
' Macro recorded 10/12/2010 by Ken Logan
'

'
    Sheets("Consolidation").Select
    Range("B6").Select
    Selection.Consolidate Sources:=Array( _
        "'C:\Documents and Settings\Ken Logan\Desktop\2010 Water Consolidation\[001.xls]1'!R10C1:R250C5" _
        , _
        "'C:\Documents and Settings\Ken Logan\Desktop\2010 Water Consolidation\[001.xls]2'!R10C1:R250C5" _
        , _
        "'C:\Documents and Settings\Ken Logan\Desktop\2010 Water Consolidation\[001.xls]3'!R10C1:R250C5" _
        , _
        "'C:\Documents and Settings\Ken Logan\Desktop\2010 Water Consolidation\[001.xls]4'!R10C1:R250C5" _
        , _
        "'C:\Documents and Settings\Ken Logan\Desktop\2010 Water Consolidation\[001.xls]5'!R10C1:R250C5" _
        , _
        "'C:\Documents and Settings\Ken Logan\Desktop\2010 Water Consolidation\[001.xls]6'!R10C1:R250C5" _
        , _
        "'C:\Documents and Settings\Ken Logan\Desktop\2010 Water Consolidation\[001.xls]7'!R10C1:R250C5" _
        , _
        "'C:\Documents and Settings\Ken Logan\Desktop\2010 Water Consolidation\[001.xls]8'!R10C1:R250C5" _
        , _
        "'C:\Documents and Settings\Ken Logan\Desktop\2010 Water Consolidation\[001.xls]9'!R10C1:R250C5" _
        , _
        "'C:\Documents and Settings\Ken Logan\Desktop\2010 Water Consolidation\[001.xls]10'!R10C1:R250C5" _
        , _
        "'C:\Documents and Settings\Ken Logan\Desktop\2010 Water Consolidation\[001.xls]11'!R10C1:R250C5" _
        ), Function:=xlSum, TopRow:=False, LeftColumn:=True, CreateLinks:=False
    
End Sub
Right after [001.xls] is the tab number or worksheet number, each represents one day.... the next code looks exactly the same save for the sheets are 12-21 and so on. If I wanted to combine all these macros or have one run another would I use next or is there a better way? This is all for one month and I have to do 12 months, so instead of naming the months Jan 2010 I just changed everything to 001, 002, 003. I don't need the month names I only need total for one year, and consolidate works great but it is limited. I don't mind making a bunch of macros if that is what I have to do; they are simple but I wondered if it is possible to combine or is it better to keep it short as making a long long long macr could make it difficult to make it work. What is the best idea?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Difficult to know what the best solution is for you without seeing the data you're working on.

It may be that using consolidate is ineffecient compared with say, using a formula to add all the different tabs together?

Either way, I think you should record a macro for all 4 stages of what you're trying to do, not just the first stage.
 
Upvote 0
Thank you, I never got back, I have been working on this. What I did was recorded macro for each stage then called the next macro, so it is four separate macro's but runs as one.

Thanks
Ken
 
Upvote 0

Forum statistics

Threads
1,215,136
Messages
6,123,249
Members
449,093
Latest member
Vincent Khandagale

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top