Consolidating two Worksheets into one separate Worksheet

Blanchetdb

Board Regular
Joined
Jul 31, 2018
Messages
171
Office Version
  1. 365
Platform
  1. Windows
Hi

I have two worksheets (SingleActions) & (BulkActions); looking to combine both into worksheet (CombineActions)
both Worksheets have the same headers and same number of columns (A:T)

take note that there are a number of other worksheets in this workbook but only looking to combine the two mentioned above

I am looking to use VBA to save the person from having to use the Data/consolidate option in the ribbon

any assistance would be greatly appreciated

thanks
 
VBA might not be necessary.
How about using the new VSTACK function?
See: Combine data in multiple worksheets...
this is what I have (sample)

SingleAction Sheet
NumberSubtypeRequest SubtypesBulkCountLocationLanguageSecurityAbolishCreation
1090Uniqueno00000
1101Securityno00100
1102Linguistic Profileno00000

BulkAction Sheet
NumberSubtypeRequest SubtypesBulkCountLocationLanguageSecurityAbolishCreation
1090Unique400004
1102Linguistic Profile505000

Result needed in CombineActions Sheet (with the same header as above)
1090Unique400004
1101Security100100
1102Linguistic Profile505000

not sure how VSTACK will do that .... When I use the consolidate function in the ribbon, I get the desired result but its manual and I need to avoid that
 
Upvote 0
Seeing the data definitely clarifies things - that is NOT what I thought you were asking.
I though you had two data lists, and wanted to list them both on one page, one above the other.
But it appears that you have common values on both pages that you want to combine/sum together.

This is really a database type scenario (would work better in Acces), but I am thinking Power Pivot or Power Pivot may be the best Excel options (though I don't use them much, as I don't do database work in Excel). There may be a way to do it with some of the newer advanced Excel functions, but that is a little bit beyond my knowledge.

What happens if you turn on the Macro Recorder, and record yourself doing the manual "Data consolidate" method?
Many times, this will record and create VBA code that you may be able to use, with a little tweaking.
Try doing that, and see if it records any code, and if it does, please post it here.
 
Upvote 0
Seeing the data definitely clarifies things - that is NOT what I thought you were asking.
I though you had two data lists, and wanted to list them both on one page, one above the other.
But it appears that you have common values on both pages that you want to combine/sum together.

This is really a database type scenario (would work better in Acces), but I am thinking Power Pivot or Power Pivot may be the best Excel options (though I don't use them much, as I don't do database work in Excel). There may be a way to do it with some of the newer advanced Excel functions, but that is a little bit beyond my knowledge.

What happens if you turn on the Macro Recorder, and record yourself doing the manual "Data consolidate" method?
Many times, this will record and create VBA code that you may be able to use, with a little tweaking.
Try doing that, and see if it records any code, and if it does, please post it here.
Holy Smokes .... never used the Macro Recorder before and had no idea it could provide a possible solution (thanks for the idea)

Had to do some "tweaking" but got it to do what I wanted ... I Added the macro to a previous series of macros for the result I needed

VBA Code:
ThisWorkbook.Worksheets("CombineActions").Activate
Worksheets("CombineActions").Range("A2:T3000").ClearContents
    ThisWorkbook.Worksheets("CombineActions").Range("A1").Select
    Selection.Consolidate Sources:=Array( _
        "'C:\Users\blanchetdb\AppData\Roaming\OpenText\DM\Temp-#22511335-v1-TEST_-_TAB_Copy_Classification_Database.XLSM]BulkDataActions'!R1C1:R3000C20" _
        , _
        "'C:\Users\blanchetdb\AppData\Roaming\OpenText\DM\Temp\-#22511335-v1-TEST_-_TAB_Copy_Classification_Database.XLSM]SingleDataActions'!R1C1:R3000C20" _
        ), Function:=xlSum, TopRow:=True, LeftColumn:=True, CreateLinks:=False
    ActiveWindow.SmallScroll Down:=6
ThisWorkbook.Worksheets("HomePage").Activate

thank you
 
Upvote 0
Solution
You are welcome! Glad it worked for you!

Yes, the Macro Recorder is a great tool to get snippets of VBA code like that - you don't have to know the VBA code, it creates it for you!
It usually just requires a little clean-up on the back-end to make it more dynamic, as the Macro Recoder is very literal, and records every select, scroll, etc, and hard-codes in ranges.
 
Upvote 0

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