Hi,
I am having trouble setting up my variable range for use in a CountIf.
First I select column A. Then go through each value in the column, looking for duplicates. I determine if it is a duplicate by checking all the cells above it for a match. The If statement should be false for the first value and true for all duplicate values, hence the "If countif > 1". I believe the problem is the variable range.
Here is my code. Thanks for any help.
PHP Code:
Sub T()
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Dim x As Range
Dim y As Long
Dim Rng As String
For Each x In Selection
y = x.Row
Rng = ("A2:A" & y)
If Application.CountIf(Rng, "x") > 1 Then
x.Offset(0, 8) = 1
End If
Next x
End Sub
Bookmarks