Checking for a duplicate value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,

I have a form which the user inputs values into various text and combo
boxes. When finished adding all information on teh form, the user clicks
submit, and the values are transferred to a sheet called 'HQ Input'. Each
row has a month field that the user selects from a combo box. There should
only be one row for each month.

Question:
When the user clicks 'Submit', i want excel to open the 'HQ Input' sheet,
loop through the existing rows and make sure the month to be inserted doesn't
already exist. If it does, i want to enable the user to either 'overwrite
the existing month row, or cancel the process.

Can anyone help on this?
 
This may help, In the appropriate place in your Submit event:-

With Worksheets("YourSheetName").Range("XX:XX") ' Change as required
Set c = .Find(<date to find>, lookin:=xlValues)
If c Is Nothing Then
' date is unique
Else
' date is not unique
End If
End With

h.
 

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

Back
Top