Monitor column for duplicate rail car numbers?

n2lectual

Board Regular
Joined
Mar 18, 2008
Messages
80
I need to monitor a column to keep from entering a rail car number I have already entered.

Worksheet1 I15 Here I enter a car number ACFX 45000

Worksheet2 D17:D117 I have a list of entries already posted.

When I enter the number in WS1 cell I15 and push Enter on the keyboard, I would like to have Worksheet1 cell I16 return a statement like "This car number is a duplicate"
OR
have a pop up say "Duplicate number, try again, click okay to continue"

Can this be done? and how? Thanks
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

njimack

Well-known Member
Joined
Jun 17, 2005
Messages
7,772
Paste the following into the sheet module of Sheet1...

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$I$15" Then Exit Sub

If WorksheetFunction.CountIf(Sheets("Sheet2").Range("D17:D117"), Target.Value) Then MsgBox "Duplicate number, try again, click ok to continue", vbInformation, "Uh oh!!"


End Sub
 
Upvote 0

Forum statistics

Threads
1,191,123
Messages
5,984,774
Members
439,910
Latest member
Flyingjoblo

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
Top