Intersecting ranges

JerryGiese

Active Member
Joined
Jun 27, 2005
Messages
323
Isn't there an object in VBA where you can enter two or more ranges and it will return the range that intersects those two ranges?
 

Some videos you may like

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Oorang

Well-known Member
Joined
Mar 4, 2005
Messages
2,071
Yes it is actually called intersect. If you would like to explicitly call it, then use Excel.Intersect:
Code:
Dim rngStuff As Excel.Range
Set rngStuff = Excel.Intersect(ActiveSheet.UsedRange, ActiveSheet.Cells(1, 2))
Note that if you prefer to use implicit code then you can just:
Code:
Dim rngStuff As Range
Set rngStuff = Intersect(ActiveSheet.UsedRange, ActiveSheet.Cells(1, 2))
 

Watch MrExcel Video

Forum statistics

Threads
1,109,466
Messages
5,528,968
Members
409,848
Latest member
Blomsten
Top