Duplicates message with explicit cell value

1021557

Board Regular
Joined
Dec 14, 2007
Messages
54
Hi,

I have a sheet that I use for tracking invoices and have written VBA to highlight if an invoice with the same number has already been entered in column K as follows:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 11 Then
If WorksheetFunction.CountIf(Columns("K"), Target.Value) > 1 Then MsgBox "Duplicate Invoice no.! Check that this invoice has not already been entered for this supplier", vbInformation
End If
End Sub


It all works great but now I want to pass this on to someone but would like to add to the above by giving an explicit message as to what cell in column K the duplictae arises if found so as to help the end user, is this possible? Any help much appreciated.

Thanks

Mike
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,223,964
Messages
6,175,659
Members
452,666
Latest member
AllexDee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top