colinharwood
Active Member
- Joined
- Jul 27, 2002
- Messages
- 426
- Office Version
- 2019
- Platform
- Windows
Hi
I have a textbox on a userform which is populated by a date in the format dd/mm/yy, from a worksheet, when the userform is initialised.
The following code is then used to increase or decrease the date as required.
'This procedure decrements the date shown in
'TextBox1 when you decrease the value of the
'SpinButton.
Private Sub SpinButton1_SpinDown()
On Error GoTo errortrap
DateSpin.Text = DateValue(DateSpin.Text) - 1
errortrap: Exit Sub
End Sub
'This procedure increments the date shown in
'TextBox1 when you increase the value of the
'SpinButton.
Private Sub SpinButton1_SpinUp()
On Error GoTo errortrap
DateSpin.Text = DateValue(DateSpin.Text) + 1
errortrap: Exit Sub
End Sub
This has worked for many months, but having just reinstalled windows, and I now find that when I alter the date using the spinbutton the format in the textbox changes to dd/mm/yyyyy.
Anybody got any ideas why this now happens?
Regards
Colin
I have a textbox on a userform which is populated by a date in the format dd/mm/yy, from a worksheet, when the userform is initialised.
The following code is then used to increase or decrease the date as required.
'This procedure decrements the date shown in
'TextBox1 when you decrease the value of the
'SpinButton.
Private Sub SpinButton1_SpinDown()
On Error GoTo errortrap
DateSpin.Text = DateValue(DateSpin.Text) - 1
errortrap: Exit Sub
End Sub
'This procedure increments the date shown in
'TextBox1 when you increase the value of the
'SpinButton.
Private Sub SpinButton1_SpinUp()
On Error GoTo errortrap
DateSpin.Text = DateValue(DateSpin.Text) + 1
errortrap: Exit Sub
End Sub
This has worked for many months, but having just reinstalled windows, and I now find that when I alter the date using the spinbutton the format in the textbox changes to dd/mm/yyyyy.
Anybody got any ideas why this now happens?
Regards
Colin