View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Joel Mills Joel Mills is offline
external usenet poster
 
Posts: 79
Default Userform retain data after closing and reopening

Thanks for your reply. I have the following code on one of the textboxes.
Since reading your reply I have created a sheet called "Hidden" that is
filled by user input, it also inputs the text into the textboxes. I don't
know how to have the Userform retrieve the cell value in C1 upon initiation
of the form.

Sub TextBox1_Change()
Sheets("Curve").Activate
Worksheets("Curve").Shapes("Curve Line No. 1").Select
Selection.Characters.Text = TitlesForm.TextBox1.Text
Sheets("Hidden").Range("C1").Value = TitlesForm.TextBox1.Text
End Sub


"bhofsetz" wrote in
message ...

Joel,
The only way I know of to retain values in userform fields when
the workbook is closed and then reopened is to have the textbox.value
assigned to a worksheet cell and then when the userform is reloaded you
have to use the initialize event procedure to read the values from the
worksheet back into each textbox. You can use a hidded worksheet so
the user won't have access to the sheet where you are temporarily
storing the textbox values
If you only want the text boxes to be able to reain their values while
the macro is running then you can assign the textbox values to public
variables before unloading the userform. Then when the userform is
reloaded use the initialize event procedure to fill the textboxes from
their respective variables.

Hope this Helps


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile:
http://www.excelforum.com/member.php...o&userid=18807
View this thread: http://www.excelforum.com/showthread...hreadid=380602