Another way is to have 3 spin buttons and have the time displayed in a label or stored in a variable. That way there's no format issues or 'too large/small' problems
Option Explicit
Private Sub UserForm_Activate()
With Me
.sbHour = 0
.sbMinute = 0
.sbSecond = 0
Call pvtUpdateTime
End With
End Sub
Private Sub cbDone_Click()
Dim dt As Date
With Me
.Hide
dt = TimeSerial(.sbHour, .sbMinute, .sbSecond)
Unload Me
End With
MsgBox "Time entered was " & Format(dt, "hh:mm:ss")
End Sub
Private Sub sbHour_Change()
With Me.sbHour
If .Value = .Max Then
.Value = .Min
ElseIf .Value = .Min Then
.Value = .Max
End If
Call pvtUpdateTime
End With
End Sub
Private Sub sbMinute_Change()
With Me.sbMinute
If .Value = .Max Then
.Value = .Min
ElseIf .Value = .Min Then
.Value = .Max
End If
Call pvtUpdateTime
End With
End Sub
Private Sub sbSecond_Change()
With Me.sbSecond
If .Value = .Max Then
.Value = .Min
ElseIf .Value = .Min Then
.Value = .Max
End If
Call pvtUpdateTime
End With
End Sub
Private Sub pvtUpdateTime()
With Me
.labTIme = Format(.sbHour, "00") & ":" & Format(.sbMinute, "00") & ":" & Format(.sbSecond, "00")
End With
End Sub
Just another idea
BTW, the attachment code is out of date, but I could not figure out how to replace it
Paul