I am using the CountiF Function in Excel VBA to check for duplicates for an array of ID numbers that are as follows:
- 1.0
- 1.1
- 1.2
- 1.3
- 1.4
- 1.5
- 1.6
- 1.7
- 1.8
- 1.9
- 1.10
- 1.11
- ...
With the code that i am using, "1.1" and "1.10", both formatted as text cells, are showing up as duplicates when i dont want them to.
The following is my code and i would like to know what tweak if possible could resolve this issue?
Thank you.
'RESET ERROR IN HISTORY
Workbooks("PERSONAL.xlsb").Sheets("History").Range("F2").Value = "No Duplicates"
'SET STARTING CELL
Cells(1, 3).Select
'GET ACTIVE COLUMN
Dim Col As Long
Col = ActiveCell.Column
'ESTABLISH END ROW
Call Get_Last_Row
Dim EndRow As Long
EndRow = ActiveCell.Row
Cells(1, Col).Select
'RUN MAIN LOOP
Dim Cell As Variant
Dim Source As Range
Set Source = Range(Cells(1, Col), Cells(EndRow, Col))
For Each Cell In Source
If Application.WorksheetFunction.CountIf(Source, Cell) > 1 Then
Workbooks("PERSONAL.xlsb").Sheets("History").Range("F2").Value = "Duplicates"
Cell.Interior.ThemeColor = xlThemeColorAccent5
End If
Next
If Workbooks("PERSONAL.xlsb").Sheets("History").Range("F2").Value = "Duplicates" Then
MsgBox "Duplicate Sheet Names Found"
End If