ColumnDifferences Method

Microsoft Excel Visual Basic

Returns a Range object that represents all the cells whose contents are different from the comparison cell in each column.

expression.ColumnDifferences(Comparison)

expression    Required. An expression that returns a Range object containing the cells to compare.

Comparison    Required Variant. A single cell to compare to the specified range.

Example

This example selects the cells in column A on Sheet1 whose contents are different from cell A4.

Worksheets("Sheet1").Activate
Set r1 = ActiveSheet.Columns("A").ColumnDifferences( _
    Comparison:=ActiveSheet.Range("A4"))
r1.Select