User Form Combo Box

raccoon588

Board Regular
Joined
Aug 5, 2016
Messages
118
Is there a way for the combo box to show the last item that was selected? if they choose Apples then submitted their data can Apples then show up in that combo box next?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Is there a way for the combo box to show the last item that was selected? if they choose Apples then submitted their data can Apples then show up in that combo box next?

You can set it up to show pretty much whatever you want. What do you mean by selected? Selected from where? Like if the combobox has a list like apples, bananas, oranges, and grapes, they select apples and submit their data, the combobox stays on apples?

Edit: Maybe you can post the code of what happens when the data is submitted and I can help you adjust it.
 
Last edited:
Upvote 0
in the code i am looking at the NAED combo box. so if they select 39795 and submit the entry the combo box will automatically show 39795. Is they change it and submit it with 39796 then once they submit the entry the combo box should show 39796.

Code:
ActiveSheet.Unprotect
Dim erow As Long
erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(erow, 1).Value = cboNAED.Value
Cells(erow, 2).Value = txtBadge.Value
Cells(erow, 3).Value = txtLotNumber.Value
Cells(erow, 4).Value = txtDefects.Value
Cells(erow, 5).Value = txtQty.Value
Cells(erow, 6).Value = Time
Cells(erow, 7).Value = Date




txtBadge.Text = ""
txtLotNumber.Text = ""
txtDefects.Text = ""
txtQty.Text = ""
cboNAED.Value = ""
 
Upvote 0
in the code i am looking at the NAED combo box. so if they select 39795 and submit the entry the combo box will automatically show 39795. Is they change it and submit it with 39796 then once they submit the entry the combo box should show 39796.

Code:
ActiveSheet.Unprotect
Dim erow As Long
erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(erow, 1).Value = cboNAED.Value
Cells(erow, 2).Value = txtBadge.Value
Cells(erow, 3).Value = txtLotNumber.Value
Cells(erow, 4).Value = txtDefects.Value
Cells(erow, 5).Value = txtQty.Value
Cells(erow, 6).Value = Time
Cells(erow, 7).Value = Date




txtBadge.Text = ""
txtLotNumber.Text = ""
txtDefects.Text = ""
txtQty.Text = ""
[COLOR=#FF0000]cboNAED.Value = ""[/COLOR]

Try taking the highlighted line out. That resets your combobox to Nothing. Without that, it should stay on whatever was selected before.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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