View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Randal W. Hozeski Randal W. Hozeski is offline
external usenet poster
 
Posts: 33
Default SpinButton Rounding Up

I use the following code in a SpinButton. If I manually edit the TextBox1
to 150.25 it is fine but when I use150.6, it rounds the result up and does
not allow the two decial point entry in fact any number over 150.5 turns
to 151. How can I keep the number entered as is without rounding it
up? Not sure which property needs adjusting,

Private Sub SpinButton1_Change()
TextBox1.Text = SpinButton1.Value
End Sub

Private Sub TextBox1_Change()
Dim NewVal As Integer

NewVal = Val(TextBox1.Text)
If NewVal = SpinButton1.Min And _
NewVal <= SpinButton1.Max Then _
SpinButton1.Value = NewVal
End Sub

-Randy-