Duplicate Values


Posted by lawrence pillay on December 06, 2001 5:25 AM

Hi there

I want to enter values via a form onto an excel spreadsheet and want to know how I could check if the value being entered already exists in the table.

For example I enter an account no in the first text box and in the second textbox I enter a value. I want to know the a record with the same account number exist in the range.

Regards
Lawrence



Posted by Juan Pablo G. on December 06, 2001 7:03 AM

Try using the Countif function, something like

If Application.Countif(Range("A:A"),TextBox1) > 0 then
MsgBox "Already Exists !"
End If

Juan Pablo G.