VBA Union – Join Multiple Ranges

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:

Leave A Comment