help needed on userforms

Johnwayne

Board Regular
Joined
Sep 6, 2005
Messages
103
how do i create a combobox in userform that dependent on data in column"A" in sheet 1..
and once i select the data using combobox in userform, my textbox will show information in column B..depending on the row i select in combobox.
please advise
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Use Insert|Name|Define to name the cells in column A eg List. Set the ComboBox's RowSource to List. Then use this code:

Code:
Private Sub ComboBox1_Change()
    TextBox1.Text = Range(ComboBox1.RowSource).Cells(ComboBox1.ListIndex + 1, 2).Value
End Sub
 

Johnwayne

Board Regular
Joined
Sep 6, 2005
Messages
103
futher problems

Ok, from there, how do I edit those textbox and save it back to my database.
As in, when I choose my item in combobox1, my texbox1 will return me a value, lets say “20. now I want to change it to 30 instead of 20. how do I edit it once I select my item in combobox1?
Besides this, how do I delete the entry by clicking a button using combobox1 to select the row that I want to delete?

Basically, I have 2 scenarios,
1) is to edit the data by selecting my item in combobox1
2) is to delete the data by selecting my item in combobox1
 

Forum statistics

Threads
1,141,095
Messages
5,704,310
Members
421,338
Latest member
Pepess

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
Top