ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checking for a duplicate value (https://www.excelbanter.com/excel-programming/387659-checking-duplicate-value.html)

Carlee

Checking for a duplicate value
 
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

Hector

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



All times are GMT +1. The time now is 12:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com