Ok. I have a column of data. Half the entries in the column will be unique numbers (IP addresses) and half will be the text "DHCP" Since the word "DHCP" will obviously repeat, I am looking for a macro to highlight duplicate numbers and ignore the word "DHCP".
The macro I am using in other columns to highlight dupilcate entries is:
Any help would be greatly appreciated.
The macro I am using in other columns to highlight dupilcate entries is:
Code:
Sub TestForMachineNameDups()
Dim LLoop As Integer
Dim LTestLoop As Integer
Dim LClearRange As String
Dim Lrows As Integer
Dim LRange As String
Dim LChangedValue As String
Dim LTestValue As String
'Test first 200 rows in spreadsheet for uniqueness
Lrows = 200
LLoop = 2
'Clear all flags
LClearRange = "E2:E" & Lrows
Range(LClearRange).Interior.ColorIndex = xlNone
Range("E1").Value = ""
'Check first 200 rows in spreadsheet
While LLoop <= Lrows
LChangedValue = "E" & CStr(LLoop)
If Len(Range(LChangedValue).Value) > 0 Then
'Test each value for uniqueness
LTestLoop = 2
While LTestLoop <= Lrows
If LLoop <> LTestLoop Then
LTestValue = "E" & CStr(LTestLoop)
'Value has been duplicated in another cell
If Range(LChangedValue).Value = Range(LTestValue).Value Then
'Set the background color to red
Range(LChangedValue).Interior.ColorIndex = 3
Range(LTestValue).Interior.ColorIndex = 3
Range("E1").Value = "Multiple Machine Name Error."
End If
End If
LTestLoop = LTestLoop + 1
Wend
End If
LLoop = LLoop + 1
Wend
End Sub
Any help would be greatly appreciated.