Thread: store variables
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default store variables

You could store them in other variables, but I would only write to the worksheet
cells after the user clicked the Ok button--not after each change to any
checkbox.



"Patrick C. Simonds" wrote:

I use the code below to put the values of the respective rng's in the
TextBoxes when the UserForm opens. What I am wondering is if there is anyway
to store those values so if the user clicks on the Cancel button the values
will be returned to there cells replacing any edits that might have taken
place.

Private Sub UserForm_Initialize()
Dim rng
Set rng = Cells(ActiveCell.Row, 1)

TextBox1.Text = rng(1, 4).Value 'ALI Time
TextBox2.Text = rng(1, 5).Value 'Vacation In Lue Of Holiday
TextBox3.Text = rng(1, 6).Value 'Floating Holiday
TextBox4.Text = rng(1, 7).Value 'Carry Over Hours
TextBox5.Text = rng(1, 8).Value 'Other Adjustments
TextBox6.Text = rng(1, 12).Value 'Comments

End Sub


--

Dave Peterson