Check duplicate value from combobox in a database and overwrite existing row in database

Mac1234

New Member
Joined
May 26, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello,
I have a database called DatabaseCB in which I want to check all of the entries in column C. If the value being entered in the 'cmbSD' combobox in the userform already exists in column C in the 'DatabaseCB' sheet I would like to overwrite the entire row with the new data (ie, "=Row() - 1" in column A, "txtSID" in column B, "cmbSD" in column C etc.). Any help is appreciated.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hello,
I have a database called DatabaseCB in which I want to check all of the entries in column C. If the value being entered in the 'cmbSD' combobox in the userform already exists in column C

Hi,
You can use the Range.Find method in you code to first check for a values existence in the range

something like

VBA Code:
  Search = Me.cmbSD.Text
    Set FoundCell = Worksheets("Database").Columns(3).Find(Search, lookat:=xlWhole, LookIn:=xlValues)
'if exists - return record row
    If Not FoundCell Is Nothing Then RecordRow = FoundCell.Row

'your code

If need further guidance post your code - plenty here to assist you

Dave
 
Upvote 0

Forum statistics

Threads
1,215,869
Messages
6,127,421
Members
449,382
Latest member
DonnaRisso

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top