UserForm Help please

GiraffetheGeek

Board Regular
Joined
May 25, 2011
Messages
58
Hi there all,

I have just ventured into creating and using UserForms.

I have a userform that has 80 textboxes on it that I want users to enter different information into.

The userform is called by a button on a sheet that has the code
Code:
Private Sub Btn_WorkBridge_Click()
    Schedule_Workbridge.Show
End Sub

I currently do not have any code in the userform_initialize function as at present I do not think I need it.

I have one button called "Close" that was the code
Code:
Private Sub CommandButton1_Click()
    Unload UserForm_WB
End Sub

What I want to happen is for a user to enter data into the relevant text fields then be able to close the user form. When the come back at a later time to open the userform again I want the data they entered previously to still be there.

Currently this does not happen and when the userform is open for subsequent times the text boxes are blank and not pre-filled.

I could work out having all the data transfered to cells on the sheet that then would be hidden and then use the initialize function to enter them all again once it is opened again but am hoping there is an easier way, maybe a "save" function somewhere that I don't know about.

As mentioned before this is my first real foray into userforms so am learning on the fly.

Cheers in advance for your help​
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
You do not need to save the vals at this point. Just hide the form w/o unloading:
Code:
Schedule_Workbridge.Hide
 
Upvote 0
Cheers that clears one thing up.

Next question:
I want the user to be able to close the whole workbook if needed, and then have those values still there once the userform is opened again after the workbook open for a second or subsequent time.

Is this possible without using code to transfer all the information to the worksheet and then use code again to re-load it all back in?
 
Upvote 0
Short answer is no. Technically, you can write to the registry, write to a textfile, etc, but saving to a hidden sheet seems easiest IMO.
 
Upvote 0
After reading my question again I may have confused the issue.

What I wanted to know was, is it possible to have the information the user enters into the userforms text boxes saved somehow so that it can be unloaded and then re-opened (possibily even having the workbook closed completely and reopened) and have that data still there, without having to transfer it back and forth from a worksheet?
 
Upvote 0
I am afraid my answer stays the same. If the wb is closed, it ain't running and neither is any code in it. Thus, any variables' values therein (in the wb) are lost unless you write them someplace. Does that make sense?
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,896
Members
452,948
Latest member
Dupuhini

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