Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
automatically close form before closing | Excel Discussion (Misc queries) | |||
Won't restart after close | Excel Discussion (Misc queries) | |||
Automatically Close Dialog Boxes | Excel Worksheet Functions | |||
close form code | Excel Discussion (Misc queries) | |||
Form Text Boxes moving | Excel Worksheet Functions |