Sub 單列查重()
Dim iRow, i, j As Long
iRow = Range("A65536").End(xlUp).Row '獲得A列有數據的最大行數.
For i = 1 To iRow - 1 '從第壹行循環至最大行數減壹行
For j = i + 1 To iRow '從第二行循環至最大行數
If Cells(i, 1) = Cells(j, 1) And Cells(i, 1) <> "" Then '判斷有沒有重復,且單元格不能等於空
Cells(i, 1).Interior.ColorIndex = 3 '要查的有重復,標記顏色為紅色
Cells(j, 1).Interior.ColorIndex = 3 '查到的有重復,標記顏色為紅色
End If
Next
Next
End Sub