Part | Description | |
object | Required. A valid object. | |
Long | Optional. A numeric expression specifying the maximum or minimum Value property setting. |
Dim TempNum As Integer
Private Sub UserForm_Initialize()
Label1.Caption = "Min -1000 to 1000"
ScrollBar1.Min = -1000
TextBox1.Text = ScrollBar1.Min
TextBox1.MaxLength = 5
Label2.Caption = "Max -1000 to 1000"
ScrollBar1.Max = 1000
TextBox2.Text = ScrollBar1.Max
TextBox2.MaxLength = 5
ScrollBar1.SmallChange = 1
ScrollBar1.LargeChange = 100
ScrollBar1.Value = 0
Label3.Caption = ScrollBar1.Value
End Sub
Private Sub TextBox1_Change()
If IsNumeric(TextBox1.Text) Then
TempNum = CInt(TextBox1.Text)
If TempNum >= -1000 And TempNum <= 1000 Then
ScrollBar1.Min = TempNum
Else
TextBox1.Text = ScrollBar1.Min
End If
Else
TextBox1.Text = ScrollBar1.Min
End If
End Sub
Private Sub TextBox2_Change()
If IsNumeric(TextBox2.Text) Then
TempNum = CInt(TextBox2.Text)
If TempNum >= -1000 And TempNum <= 1000 Then
ScrollBar1.Max = TempNum
Else
TextBox2.Text = ScrollBar1.Max
End If
Else
TextBox2.Text = ScrollBar1.Max
End If
End Sub
Private Sub ScrollBar1_Change()
Label3.Caption = ScrollBar1.Value
End Sub