Forms VisualBasic Script

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