ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,226
- Office Version
- 2007
- Platform
- Windows
Hi,
I am using the code shown below which works well but wondering if it can be used / edited or just start again.
Currently the code looks in Column B for dupliacte names & the cell colour is shown white for the user to see.
As my list is getting longer i think it best to populate a listbox with the duplicate names & the row they are in.
Many thanks if you could advise
I am using the code shown below which works well but wondering if it can be used / edited or just start again.
Currently the code looks in Column B for dupliacte names & the cell colour is shown white for the user to see.
As my list is getting longer i think it best to populate a listbox with the duplicate names & the row they are in.
Many thanks if you could advise
Rich (BB code):
Private Sub DuplicateNameSearch_Click()
Unload PostageLinkForm
Dim cell As Variant
Dim Source As Range
Dim dups As Long
Set Source = Range("B8:B5000")
For Each cell In Source
If Application.WorksheetFunction.CountIf(Source, cell) > 1 Then
cell.Interior.Color = RGB(255, 255, 255)
dups = dups + 1
End If
Next cell
If dups > 0 Then
MsgBox " DUPLICATE NAMES WERE FOUND & HAVE BEEN HIGHLIGHTED " & vbNewLine & "********** WHITE IN COLUMN B FOR YOU TO CHECK **********", vbCritical, "POSTAGE DUPLICATE CHECKER"
Else
MsgBox " NO DUPLICATE CUSTOMER NAMES WERE FOUND ", vbInformation, "POSTAGE DUPLICATE CUSTOMER NAME CHECKER"
End If
End Sub