Range の ColumnDifferences メソッド (Excel)Range.ColumnDifferences method (Excel)
オブジェクトを返すメソッドです。対象セル範囲内のセルと各列の比較セルで、内容の異なるすべてのセル (Range オブジェクト) を返します。Returns a Range object that represents all the cells whose contents are different from the comparison cell in each column.
構文Syntax
式。Columndifferences 相違点(比較)expression.ColumnDifferences (Comparison)
expression は Range オブジェクトを表す変数です。expression A variable that represents a Range object.
パラメーターParameters
名前Name | 必須 / オプションRequired/Optional | データ型Data type | 説明Description |
---|---|---|---|
比較Comparison | 必須Required | VariantVariant | 指定したセルと比較する単一セルを指定します。A single cell to compare to the specified range. |
戻り値Return value
範囲Range
例Example
次の使用例は、シート 1 の列 A のセルのうち、セル A4 とは内容が異なるセルを選択します。This example selects the cells in column A on Sheet1 whose contents are different from cell A4.
Sub CompDiff()
'Setting up data to be compared
Range("A1").Value = "Rod"
Range("A2").Value = "Bill"
Range("A3").Value = "John"
Range("A4").Value = "Rod"
Range("A5").Value = "Kelly"
Range("A6").Value = "Rod"
Range("A7").Value = "Paddy"
Range("A8").Value = "Rod"
Range("A9").Value = "Rod"
Range("A10").Value = "Rod"
'Code to do the comparison, selects the values that are unlike A1
Worksheets("Sheet1").Activate
Set r1 = ActiveSheet.Columns("A").ColumnDifferences( _
Comparison:=ActiveSheet.Range("A1"))
r1.Select
End Sub
サポートとフィードバックSupport and feedback
Office VBA またはこの説明書に関するご質問やフィードバックがありますか?Have questions or feedback about Office VBA or this documentation? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.