Table of Contents

Union and Intersect

The Union method in Excel VBA returns a Range object that represents the union of two or more ranges (borders below for illustration only).

Code line:

Union(Range(“B2:C7”) Range(“C6:F8”)).Select

Result:

Union Of Two Ranges

Note: the Union method doesn’t return the mathematical union (cell C6 and cell C7 are included twice).

The Intersect method in Excel VBA returns a Range object that represents the intersection of two or more ranges (borders below for illustration only).

Code line:

Intersect(Range(“B2:C7”) Range(“C6:F8”)).Select

Result:

Intersection Of Two Ranges

Leave A Comment

Excel meets AI – Boost your productivity like never before!

At Formulas HQ, we’ve harnessed the brilliance of AI to turbocharge your Spreadsheet mastery. Say goodbye to the days of grappling with complex formulas, VBA code, and scripts. We’re here to make your work smarter, not harder.

Related Articles

The Latest on Formulas HQ Blog