philfer
04-07-2008, 09:55 AM
Hello,
I am trying to loop through a list of cells to see if there are duplicates and an using :-
Sub test()
Dim i As Integer
With ActiveSheet
For i = 1 To 10
If WorksheetFunction.CountIf(.Columns("A:A"), .Cells(i, 1)) > 1 Then
.Cells(i, 1).ColorIndex = 6
.Cells(i, 1).Pattern = xlSolid
End If
Next i
End With
End Sub
Can anyone see my error?
I am trying to loop through a list of cells to see if there are duplicates and an using :-
Sub test()
Dim i As Integer
With ActiveSheet
For i = 1 To 10
If WorksheetFunction.CountIf(.Columns("A:A"), .Cells(i, 1)) > 1 Then
.Cells(i, 1).ColorIndex = 6
.Cells(i, 1).Pattern = xlSolid
End If
Next i
End With
End Sub
Can anyone see my error?