Hi, I want to write a code which checks values in one column. If they're equal, they have yellow color. Unfortunately, my code doesn't work. If you could help me, I will be very happy. My code below.
Sub Compare()
Dim sh As Range
Dim i, j As Long
For Each sh In Range("A1:A17")
For i = 1 To 17
For j = 1 To 17
If sh(i, "A") = sh(j, "A") Then
sh(i, "A").Interior.Color = vbYellow
sh(j, "A").Interior.Color = vbYellow
End If
Next j
Next i
Next sh
End Sub
Sub Compare()
Dim sh As Range
Dim i, j As Long
For Each sh In Range("A1:A17")
For i = 1 To 17
For j = 1 To 17
If sh(i, "A") = sh(j, "A") Then
sh(i, "A").Interior.Color = vbYellow
sh(j, "A").Interior.Color = vbYellow
End If
Next j
Next i
Next sh
End Sub