IsEqual Method
TOC
Collapse the table of content
Expand the table of content

Range.IsEqual Method (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

True if the range to which this method is applied is equal to the range specified by the Range argument.

expression .IsEqual(Range)

expression Required. A variable that represents a Range object.

Parameters

Name

Required/Optional

Data Type

Description

Range

Required

Range

The range to compare with the Range object defined by expression.

Return Value

Boolean

This method compares the starting and ending character positions and the story type. If all three of these items are the same for both objects, the objects are equal.

This example compares Range1 with Range2 to determine whether they're equal. If the two ranges are equal, the content of Range1 is deleted.

Set Range1 = Selection.Words(1) 
Set Range2 = ActiveDocument.Words(3) 
If Range1.IsEqual(Range:=Range2) = True Then 
 Range1.Delete 
End If

Concepts

Other resources

Show:
© 2016 Microsoft