C
Corey ....
The following code is suppose to increment time in hh:mm AM/PM.
I set the Starting time to a value of 930, which is 3:30 PM.
I change the Small Increment of the SpinButton to 15, so it only moves in
15min increments.
But the default value of the Texbox ALWAYS seem to come up as 8:00AM, even
though i have the 930 set to the spinbutton.
When i click the SpinButton_Up once it moves from 8:00AM to 3:45PM.
If i then click the SpinButton_Down ONCE it moves from the 3:45PM to 8:30PM,
then another click it moves to 3:15PM.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub CommandButton1_Click()
UserForm1.ActiveControl = TextBox1.Value
Unload Me
End Sub
~~~~~~~~~~
Private Sub SpinButton1_SpinDown()
TextBox1 = Format(TextBox1.Value, "00.00")
If TextBox1 = "" Then
TextBox1.Value = SpinButton1.Value
Else: TextBox1 = SpinButton1.Value / 1440 - CInt(TextBox1.Value)
End If
TextBox1 = Format(TextBox1.Value, "hh:mm AM/PM")
End Sub
~~~~~~~~~
Private Sub SpinButton1_SpinUp()
TextBox1 = Format(TextBox1.Value, "00.00")
If TextBox1 = "" Then
TextBox1.Value = SpinButton1.Value
Else: TextBox1 = SpinButton1.Value / 1440 + CInt(TextBox1.Value)
End If
TextBox1 = Format(TextBox1.Value, "hh:mm AM/PM")
End Sub
~~~~~~~~~
Private Sub UserForm_Initialize()
TextBox1.Value = Format(0.3333333, "hh:mm AM/PM")
SpinButton1.Value = 930
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Am i missing something here ?
I also have another identical form with the same code and set the SpinButton
to 450 (7:30AM), but it ALWAYS shows 8:00AM instead ???
Why ?
I set the Starting time to a value of 930, which is 3:30 PM.
I change the Small Increment of the SpinButton to 15, so it only moves in
15min increments.
But the default value of the Texbox ALWAYS seem to come up as 8:00AM, even
though i have the 930 set to the spinbutton.
When i click the SpinButton_Up once it moves from 8:00AM to 3:45PM.
If i then click the SpinButton_Down ONCE it moves from the 3:45PM to 8:30PM,
then another click it moves to 3:15PM.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub CommandButton1_Click()
UserForm1.ActiveControl = TextBox1.Value
Unload Me
End Sub
~~~~~~~~~~
Private Sub SpinButton1_SpinDown()
TextBox1 = Format(TextBox1.Value, "00.00")
If TextBox1 = "" Then
TextBox1.Value = SpinButton1.Value
Else: TextBox1 = SpinButton1.Value / 1440 - CInt(TextBox1.Value)
End If
TextBox1 = Format(TextBox1.Value, "hh:mm AM/PM")
End Sub
~~~~~~~~~
Private Sub SpinButton1_SpinUp()
TextBox1 = Format(TextBox1.Value, "00.00")
If TextBox1 = "" Then
TextBox1.Value = SpinButton1.Value
Else: TextBox1 = SpinButton1.Value / 1440 + CInt(TextBox1.Value)
End If
TextBox1 = Format(TextBox1.Value, "hh:mm AM/PM")
End Sub
~~~~~~~~~
Private Sub UserForm_Initialize()
TextBox1.Value = Format(0.3333333, "hh:mm AM/PM")
SpinButton1.Value = 930
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Am i missing something here ?
I also have another identical form with the same code and set the SpinButton
to 450 (7:30AM), but it ALWAYS shows 8:00AM instead ???
Why ?