|
VBAだけでなく、ワークシート関数の学習もした方がいいですよ。
Sub Test2()
Dim C As Range
On Error Resume Next
With Range("A1", Range("A65536").End(xlUp))
.Interior.ColorIndex = xlColorIndexNone
With .Offset(, 254)
.Formula = "=IF(ISNUMBER($A1),IF(COUNTIF($A$A,$A1)>1,1))
.SpecialCells(3, 1).Offset(, -254).Interior.ColorIndex = 3
End With
With .Offset(, 255)
.Formula = "=IF(ISNUMBER($A1),IF(COUNTIF($A$1:$A1,$A1)>1,1))"
For Each C In .SpecialCells(3, 1)
MsgBox C.Offset(, -255).Value & vbLf & _
"が、重複しています"
Next
End With
.Offset(, 254).Resize(, 2).ClearContents
End With
End Sub
|
|