How to create a Union query in EXL 2007

blair878

New Member
Joined
Jul 13, 2012
Messages
2
Hello. I'm trying to create a pivot using multiple sheets in EXL 2007 but research has shown a union query would be the best way to do what I need. My data consists of around 4-6 sheets with two - four columns being used and rows can be in excess of 100, 000. A recent report I had showed 310, 569 rows for the month.

While I'm advanced in EXL, I have no idea how to create this.:mad2: The few times I have tried it has not worked for me and I'm hoping someone can provide some direction.

Thanks!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hello. I'm trying to create a pivot using multiple sheets in EXL 2007 but research has shown a union query would be the best way to do what I need. My data consists of around 4-6 sheets with two - four columns being used and rows can be in excess of 100, 000. A recent report I had showed 310, 569 rows for the month.

While I'm advanced in EXL, I have no idea how to create this.:mad2: The few times I have tried it has not worked for me and I'm hoping someone can provide some direction.

Thanks!

This example code creates a union range for two cell groups in different columns and an entire column, then colors those cells in the union range, then removes the color. Once the union range is created, it has properties like a any other range. You can delete it, copy it, paste it, etc.

Code:
Sub testUnion()
Dim sh As Worksheet, uRng As Range
Set sh = Sheets(1)
Set uRng = Union(Range("A2:A10"), Range("D4:D8"), Range("B:B"))
uRng.Interior.ColorIndex = 3
MsgBox "View colors"
uRng.Interior.ColorIndex = xlNone
End Sub
Code:
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

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