VBA Union – Join Multiple Ranges

Associated Files Download Links

Union – Join Multiple Ranges

You might want to combine or join multiple ranges if the range string is too long, or you want to attempt to make your code easier to work with.
The need to combine multiple range strings is probably most common when selecting a large number of non contiguous cells with VBA.
One way to join multiple range strings is using VBA’s Union function. The syntax for the Union function is:

The following is an example of using Union. First you declare some range variables, then set the range variables equal to something, and finally combine them using Union.

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

alt text

Learn More!

<<Return to VBA Examples

Did you find this VBA tutorial useful? Then share it with your friends and colleagues:

You may also like some of this related content...

We have already gone over what variables and constants are, in our VBA Data Types
Named Ranges Using named ranges when programming references to cells can save you time and
If you want to test a condition for each cell in a range using VBA,
Find Max Value For Each Column in Range The following function will return the Maximum
When formatting a cell in excel using VBA you may want to make sure you