Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retain values of combo box
I have a userform with several combo boxes so that the user can select
certain features. Upon clicking the "OK" button, the values are then inserted into the appropriate ranges on the spreadsheet. Is there a way that the values selected in the combo boxes can be retained after the userform is either hidden or dismissed. I would like the last values selected in case the user changes his mind and would like to edit one or two selections without having to re-select all of them. I tried just hiding the userform, but that did not work. Thanks, Greg |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retain values of combo box
Why not just reload the combobox with the value in the
cell that corresponds to it? UserForm1.ComboBox1.Value = Sheets("Sheet1").[A1].Value HTH Jason Atlanta, GA -----Original Message----- I have a userform with several combo boxes so that the user can select certain features. Upon clicking the "OK" button, the values are then inserted into the appropriate ranges on the spreadsheet. Is there a way that the values selected in the combo boxes can be retained after the userform is either hidden or dismissed. I would like the last values selected in case the user changes his mind and would like to edit one or two selections without having to re- select all of them. I tried just hiding the userform, but that did not work. Thanks, Greg . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retain values of combo box
Have a look at the userforms collection... problem is you can't easily access a member of that collection by name. dim uf as object 'initialize the userform 'the initialize event of the form is triggered set uf = userforms.add("userform1") 'or New userform1 'show the userform (activate event is triggered) uf.show 'code returns here after form is hidden(deactivated) or closed(terminated). 'if it is hidden the form remains in memory, and values are retained. if userforms.count 0 then userforms(1).show else msgbox "no loaded forms" endif -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam gig wrote : I have a userform with several combo boxes so that the user can select certain features. Upon clicking the "OK" button, the values are then inserted into the appropriate ranges on the spreadsheet. Is there a way that the values selected in the combo boxes can be retained after the userform is either hidden or dismissed. I would like the last values selected in case the user changes his mind and would like to edit one or two selections without having to re-select all of them. I tried just hiding the userform, but that did not work. Thanks, Greg |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retain values of combo box
This is the code I have:
Private Sub CommandButton1_Click() Dim code_series As Range Range("code_series") = CodeBox1 UserForm1.CodeBox1.Value = Sheets("Input Sheet").Range("z2").Value UserForm1.Hide End Sub The funny thing is, on my work computer, the last value entered was retained in the codebox, but on my home computer, it is not. Anyone see anything wrong with this code? Thanks, Greg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy and replace xlsm files, but retain the values in selected cells... | Excel Discussion (Misc queries) | |||
Values to Combo Box | Excel Discussion (Misc queries) | |||
Add two cell values, retain it, and add another value | Excel Worksheet Functions | |||
registering the cell values of excel combo box associated values | Excel Programming | |||
After Workbook closes all my combo boxes do not retain dropdown list. | Excel Programming |