ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,859
- Office Version
- 2007
- Platform
- Windows
I hope ive done this code correct but unable to confirm due to this post request.
On my worksheet i wish to check for any duplicate invoice numbers that are in column P
Also in column P will be the value N/A
Currently the code picks up this N/A as a duplicate to im unable to continue or check if code works for me.
Please advise how i cant have the code forget the value N/A below is what i have in place.
Thanks
On my worksheet i wish to check for any duplicate invoice numbers that are in column P
Also in column P will be the value N/A
Currently the code picks up this N/A as a duplicate to im unable to continue or check if code works for me.
Please advise how i cant have the code forget the value N/A below is what i have in place.
Thanks
VBA Code:
Private Sub DuplicateChecker_Click()
Dim Cell As Range
With Intersect(ActiveSheet.Columns("P"), ActiveSheet.UsedRange)
For Each Cell In .Cells
If WorksheetFunction.CountIf(.Resize(Cell.Row - .Rows(1).Row + 1), Cell.Value) > 1 Then
MsgBox "DUPLICATE INVOICE " & Cell.Value & " IN CELL " & Cell.Address(False, False) & vbLf & "PLEASE CHECK THIS OUT.", vbCritical, "DUPLICATE CUSTOMER NAME FINDER"
Cell.Select
Exit Sub
End If
Next Cell
End With
MsgBox "NO DUPLICATE INVOICE NUMBERS WERE FOUND", vbInformation, "DUPLICATE INVOICE FINDER"
End Sub