Finding duplicates in list during UserForm entry process

E

excelnut1954

I'm designing a userform to be usee to add new records to a worksheet.

The user enters will enter the PO# in the userform in the 1st box. What
I would like to know, is there any coding I can include that will cause
that PO# entered by the user to be matched against all the PO numbers
already on the list? If so, I'll have a message box come up, telling
the user how to handle the duplicate.

Ideally, before the user goes on to the 2nd box in the userform, I
would like the check to be made if there is a duplicate.

The range name of the header for the PO number column is
"PO_OfficialList".

I'm sure this would work better if we were maintaining this list in
Access, but that isn't possible here at this time. I'm the only person
here in this dept that has Access.

So, can what I described be done with VBA coding?

Thanks,
J.O.
 
D

Dave Peterson

with worksheets("sheet1")
if application.countif(.range("e:e"),mypovariable) > 0 then
msgbox "already there
else
'ok to add
end if
end with

is one way.
 
E

excelnut1954

Thanks for replying. A few questions about this.
I'll replace "sheet1" with the actual sheet name. I understand that.

Not sure about the 2nd line. Is the dot in front of range as in
(.range is this correct?
Also, what would mypovariable stand for? Would I replace this, too?
Not sure if all the components of this line are literal, or if I'm to
replace any of this.
Would the (e:e") part be replaced with the column letter I want it to
look at?

Thanks for your time.
J.O.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top