Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 204
Default text boxes retaining their last value on form close and restart

In my user form there are 5 text boxes. Rider1 through Rider5. Is there a way
to store the values of these text boxes so the last values come up as the
starting values if the user accidently closes down the form (x in top right)
and then clicks the button to restart it.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default text boxes retaining their last value on form close and restart

Insert a module and declare variables to store these values which will remain
untl the user close the workbook.

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

In my user form there are 5 text boxes. Rider1 through Rider5. Is there a way
to store the values of these text boxes so the last values come up as the
starting values if the user accidently closes down the form (x in top right)
and then clicks the button to restart it.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default text boxes retaining their last value on form close and restar

If you are new to VBA/programming; from VBAProject Explorer right click the
userform icon. Insert Module and declare your vairables as below

Public strTextBox1 As Variant
Public strTextBox2 As Variant
Public strTextBox3 As Variant

-----------------------------------------------------------------------------
In userform code store the values on terminate and reassign on activate

Private Sub UserForm_Activate()
Rider1.Text = strTextBox1
Rider2.Text = strTextBox2
Rider3.Text = strTextBox3
End Sub

Private Sub UserForm_Terminate()
strTextBox1 = Rider1.Text
strTextBox2 = Rider2.Text
strTextBox3 = Rider3.Text
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

Insert a module and declare variables to store these values which will remain
untl the user close the workbook.

If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

In my user form there are 5 text boxes. Rider1 through Rider5. Is there a way
to store the values of these text boxes so the last values come up as the
starting values if the user accidently closes down the form (x in top right)
and then clicks the button to restart it.

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default text boxes retaining their last value on form close and restart

It sounds like you've assigned a cell to the ControlSource property for the
textboxes.

You may find it easier to drop that technique and use the OK button to update
the cells with the values from the textboxes.

And you can use the _initialize procedure to populate the textboxes with the
values from the cells:

Option Explicit
Private Sub UserForm_Initialize()
Me.TextBox1.Value = Worksheets("Sheet1").Range("A1").Text
End Sub



NDBC wrote:

In my user form there are 5 text boxes. Rider1 through Rider5. Is there a way
to store the values of these text boxes so the last values come up as the
starting values if the user accidently closes down the form (x in top right)
and then clicks the button to restart it.

Thanks


--

Dave Peterson
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
automatically close form before closing Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 0 September 19th 08 08:26 PM
Won't restart after close Markk Primack[_2_] Excel Discussion (Misc queries) 3 September 2nd 07 02:27 PM
Automatically Close Dialog Boxes chriskane Excel Worksheet Functions 2 August 9th 05 12:14 PM
close form code tkaplan Excel Discussion (Misc queries) 1 June 3rd 05 10:49 PM
Form Text Boxes moving md2503 Excel Worksheet Functions 2 May 16th 05 07:57 PM


All times are GMT +1. The time now is 04:11 PM.

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"