Need code corrections "get sub or function not defined" error"
It's suppose to check in col "f" and "G" for duplicates. I get a "sub or Function not defined" error. Thanks
Sub checkfordups()
Dim LLoop As Integer
Dim LTestLoop As Integer
Dim LClearRange As String
Dim Lrows As Integer
Dim LRange As String
'Column F values
Dim LChangedValue As String
Dim LTestValue As String
'Column G values
Dim LChangedValueG As String
Dim LTestValueG As String
'Test the first 200 rows
Lrows = 200
LLoop = 2
'Clear colors
LClearRange = "F2:G" & Lrows
Range(LClearRange).Interior.ColorIndex = xlNone
'Check first 200 rows
While LLoop <= Lrows
LChangedValue = "F" & CStr(LLoop)
LChangedValueG = "G" & CStr(LLoop)
If Len(Range(LChangedValue).Value) > 0 Then
'test each value for uniqueness
LTestLoop = 2
While LTestLoop <= Lrows
If LLoop <> LTestLoop Then
LTestValue = "F" & CStr(LTestLoop)
LTestValueG = "G" & CStr(LTestLoop)
'value has been duplicated in another cell
If (Range(LChangedValue).Value = Range(LTestValue).Value) And (Range(LChangedValueG).Value = Range(LTestValueG).Value) Then
'set color to red in column F
Range(LChangedValue).Interior.ColorIndex = 3
Range(LTestValue).Interior.ColorIndex = 3
' set color to red in column G
Range(LChangedValueG).Interior.ColorIndex = 3
Range(LTestValueG).Interior.ColorIndex = 3
End If
End If
LTestLoop = LTestLoop + 1
Wend
End If
LLoop = LLoop + 1
Wend
End Sub
|