combo Box Trouble

Kavy

Well-known Member
Joined
Jun 25, 2007
Messages
607
Hello, I have a combo box, text box, Save button and a multi col list On a user form with vb excel

The combo box is filled with the index of the list ( 0 through Mylist.listcount-1)

The user enters data into the textbox, which after you click a save command, it appears in the list, on the row specifyed by the combo box.

Is there a way to save on the fly, like get rid of the button?
I tried to code it in the combo box but nothing comes up!

Here is what i was trying, I was trying to make it so what ever was in the spot on the list would appear and if the user edits it, it changes.
Thanks for any suggestions!

Code:
Private Sub ComRow_Change()
Dim k As Integer
dim i as integer

i = ComRow.listIndex
k = ComRow.ListCount
If ComRow.Text > i Or ComRow.Text < 0 Then
    MsgBox ("Please enter a value between 1 and " & k)
    Exit Sub
End If

If ComRow.Text = "" Then
    Exit Sub
End If

txtPM.Text = listEquip.list(i, 7)



listEquip.list(i, 7) = txtPM.Text
 
also quick question, i am trying to manipulate the code, if i would like the new text for the text box to equal what ever is in a certain list spot according to the index of the combo box how would i do that?

like

if the combo box is changed to 3, then the textbox's text is the same as the text in the list with the index of 3
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Add to the ComboBox_AfterUpdate routine something like.

Code:
Me.Textbox1.Value=Sheets("sheet1").cells(Me.Combobox1.ListIndex,1)
 
Upvote 0

Forum statistics

Threads
1,216,172
Messages
6,129,292
Members
449,498
Latest member
Lee_ray

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