Share via


Application.Intersect Method

Excel Developer Reference

Returns a Range object that represents the rectangular intersection of two or more ranges.

Syntax

expression.Intersect(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30)

expression   A variable that represents an Application object.

Parameters

Name Required/Optional Data Type Description
Arg1 Required Range The intersecting ranges. At least two Range objects must be specified.
Arg2 Required Range The intersecting ranges. At least two Range objects must be specified.
Arg3 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg4 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg5 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg6 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg7 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg8 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg9 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg10 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg11 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg12 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg13 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg14 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg15 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg16 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg17 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg18 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg19 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg20 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg21 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg22 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg23 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg24 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg25 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg26 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg27 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg28 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg29 Optional Variant The intersecting ranges. At least two Range objects must be specified.
Arg30 Optional Variant The intersecting ranges. At least two Range objects must be specified.

Return Value
Range

Example

This example selects the intersection of two named ranges, rg1 and rg2, on Sheet1. If the ranges don't intersect, the example displays a message.

Visual Basic for Applications
  Worksheets("Sheet1").Activate
Set isect = Application.Intersect(Range("rg1"), Range("rg2"))
If isect Is Nothing Then
    MsgBox "Ranges do not intersect"
Else
    isect.Select
End If

See Also