View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Hector Hector is offline
external usenet poster
 
Posts: 12
Default Checking for a duplicate value

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.

"Carlee" wrote:

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?
--
Carlee