Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
gig gig is offline
external usenet poster
 
Posts: 9
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default 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   Report Post  
Posted to microsoft.public.excel.programming
gig gig is offline
external usenet poster
 
Posts: 9
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy and replace xlsm files, but retain the values in selected cells... ARbitOUR Excel Discussion (Misc queries) 1 April 24th 09 04:21 PM
Values to Combo Box AmandaH Excel Discussion (Misc queries) 2 March 1st 06 01:19 PM
Add two cell values, retain it, and add another value Jay Excel Worksheet Functions 7 April 22nd 05 06:24 PM
registering the cell values of excel combo box associated values john_stevens Excel Programming 1 May 21st 04 09:39 PM
After Workbook closes all my combo boxes do not retain dropdown list. cwsax Excel Programming 0 November 6th 03 10:25 PM


All times are GMT +1. The time now is 06:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"