R
ryanmcwh
I'm writing an employment evaluation. I have several userforms with
textbox1 and textbox2. textbox1 is a value between 0 and 3 controlled
by a spinbutton (spinbutton1), the only spinbutton on the userform.
textbox2 is a plain text entry box used for comment entry. The issue
I'm having is that if I type my comments in textbox2 first then click
either the up or down buttons on the spinbutton, textbox2 is erased.
What's strange is that if I click the spinbutton first, giving the
employee a rating, and then type in textbox2, and then go back and
click on the spinbutton, the text remains in textbox2. Essentially you
must give a rating first or you will lose any text you enter. I don't
have any code that should erase textbox2 for any reason. Both
textboxes are linked to separate cells on the same sheet. Below is the
code for the spinbutton which is the only code behind the userform.
Thanks for any advice!
Private Sub SpinButton1_SpinDown()
Sheets("calc").Select
For Each cell In ActiveSheet.Range("C57")
If TextBox1.Value > 0 Then cell.Value = cell.Value - 0.1
Next
End Sub
Private Sub SpinButton1_SpinUp()
Sheets("calc").Select
For Each cell In ActiveSheet.Range("C57")
If TextBox1.Value < 3 Then cell.Value = cell.Value + 0.1
Next
End Sub
textbox1 and textbox2. textbox1 is a value between 0 and 3 controlled
by a spinbutton (spinbutton1), the only spinbutton on the userform.
textbox2 is a plain text entry box used for comment entry. The issue
I'm having is that if I type my comments in textbox2 first then click
either the up or down buttons on the spinbutton, textbox2 is erased.
What's strange is that if I click the spinbutton first, giving the
employee a rating, and then type in textbox2, and then go back and
click on the spinbutton, the text remains in textbox2. Essentially you
must give a rating first or you will lose any text you enter. I don't
have any code that should erase textbox2 for any reason. Both
textboxes are linked to separate cells on the same sheet. Below is the
code for the spinbutton which is the only code behind the userform.
Thanks for any advice!
Private Sub SpinButton1_SpinDown()
Sheets("calc").Select
For Each cell In ActiveSheet.Range("C57")
If TextBox1.Value > 0 Then cell.Value = cell.Value - 0.1
Next
End Sub
Private Sub SpinButton1_SpinUp()
Sheets("calc").Select
For Each cell In ActiveSheet.Range("C57")
If TextBox1.Value < 3 Then cell.Value = cell.Value + 0.1
Next
End Sub