返回一个
Range 对象,该对象表示每列中所有与比较单元格内容不同的单元格。
语法
表达式.ColumnDifferences(Comparison)
表达式 一个代表 Range 对象的变量。
参数
名称 |
必选/可选 |
数据类型 |
说明 |
Comparison |
必选 |
Variant |
用于对指定区域进行比较的单个单元格。 |
返回值
Range
示例
本示例选定工作表 Sheet1 上 A 列中与单元格 A4 内容不同的单元格。
示例代码 |
function CompDiff(){
//Setting up data to be compared55
Range("A1").Value2 = "Rod"
Range("A2").Value2 = "Bill"
Range("A3").Value2 = "John"
Range("A4").Value2 = "Rod"
Range("A5").Value2 = "Kelly"
Range("A6").Value2 = "Rod"
Range("A7").Value2 = "Paddy"
Range("A8").Value2 = "Rod"
Range("A9").Value2 = "Rod"
Range("A10").Value2 = "Rod"
//Code to do the comparison, selects the values that are unlike A1
Worksheets.Item("Sheet1").Activate()
let r1 = ActiveSheet.Columns.Item("A").ColumnDifferences(ActiveSheet.Range("A1"))
r1.Select()
}
|
Column Differences Method