PDA

View Full Version : Solved: check for existing value



samohtwerdna
11-07-2005, 08:00 AM
OK another question for you great minds,

I have a VBA form that I am using to fill out a spreadsheet for sample orders. on the form the user needs to fill out the Job Number. The Job number needs to be unique - so I want to check for any occurances of the entered value already on my spreadsheet and then warn the user that that Job Number is already in use.

Any thoughts??

Thanks,

Bob Phillips
11-07-2005, 08:03 AM
OK another question for you great minds,

I have a VBA form that I am using to fill out a spreadsheet for sample orders. on the form the user needs to fill out the Job Number. The Job number needs to be unique - so I want to check for any occurances of the entered value already on my spreadsheet and then warn the user that that Job Number is already in use.

Any thoughts??

Thanks,


If Application.COUNTIF(Range("A1:A100"), Textbox1.Text) > 0 Then
MsgBox "Already used"
End IF

samohtwerdna
11-07-2005, 08:13 AM
Thanks xld!

That was painless. I guess I need to look into the COUNTIF function - seems like I could use this for a few other things as well.