User Form ComboBoxes and CheckBoxes are blank

Grimm127

Board Regular
Joined
Aug 17, 2011
Messages
132
Hi All you Guru's!

I am having a little trouble with my use form. The form has 5 combo boxes and 12 check boxes. All my links work and everything seems fine with the exception of when I open the user form all the boxes are blank.

So If I select 5 check boxes and then close it and then reopen it those same are blank. What am I missing? I would like to keep the selections or the very least is have all he check boxes with the checks and the combo boxes to be set at the first selection. Can anyone help me out?

Sub Userform()
Dim form as new Userform1
form.Show
End Sb

Private Sub Close_Box
me.hide
End sub
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
If you hide the Userform all controls on the Userform should maintain their prior setting
This is until you close your workbook.
If you close your workbook you will loose all those previous settings

Like if you put "Mom" in Textbox1 and then hide the userform the next time you show the userform "Mom" should still be in Textbox1

But if you close the workbook Mom will be lost.


What does this mean:
All my links work

What do you mean by link?
A Hyperlink or what?
 
Last edited:
Upvote 0
How are you hiding the form (running the Close_Box() procedure)? A commandbutton on the form with the following code added to your code works fine to keep the data from the previous showing.

Code:
Private Sub CommandButton1_Click()
    Close_Box
End Sub

If you close the form by clicking on the red X in the corner, the form gets destroyed and showing the form again creates a new instance with nothing saved from before.
 
Upvote 0
Hi,

When you tick your box and leave the UF, you can put some values to true (you can use a public boolean, a defined name or even a cell), then when you initiate your UF again, set the box value to your boolean (or whatever you chose)
 
Last edited:
Upvote 0
If you hide the Userform all controls on the Userform should maintain their prior setting
This is until you close your workbook.
If you close your workbook you will loose all those previous settings

Like if you put "Mom" in Textbox1 and then hide the userform the next time you show the userform "Mom" should still be in Textbox1

But if you close the workbook Mom will be lost.


What does this mean:
All my links work

What do you mean by link?
A Hyperlink or what?

Hi,
I mean the selections I make in those boxes are also set into cells. So I meant I wasn't getting errors. What you said above is exactly how it should work but for some reason when I internalize the userform all the boxes are blank.....
 
Upvote 0
Thank you for that. I see what you mean so with some code, I can basically make the checkbox with a check or a combo box have a value in place when I open it....But I don't know how to code it
 
Upvote 0
We can write code to set controls like you want when you open the userform.

Give me some details:

Like this:

Textbox1. Value="Jack"

Or Checkbox1.value=True

Or if you want them all set back to the same way when closed and this will not always be the same we would have to write a lot of code to do that.

So how important is this to you.

You would have to give us the name of every control where you want the value saved.
 
Upvote 0
How about if I have those values for the combobox = a cell reference in the spread sheet
For the checkbox, I can use what you mentioned above nested in the user form after the form.show code
Would that make sense?
 
Upvote 0
Well I would need to know the name of the Combobox and what cell or cells should we reference.

For example Combobox1.list=Range("A1:A20").value

You could put this in your initialize code which runs when you open the userform.
 
Upvote 0

Forum statistics

Threads
1,216,101
Messages
6,128,835
Members
449,471
Latest member
lachbee

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