Option Explicit
Private ChangementInduit As Boolean
Private Sub UserForm_Initialize()
Dim M As Long
For M = 0 To 1425 Step 15
Me.ComboBox1.AddItem Format(M / 1440, "hh:mm")
Next M
Me.ComboBox2.List = Me.ComboBox1.List
Me.ComboBox3.List = Me.ComboBox1.List
End Sub
Private Sub ComboBox1_Change()
If ChangementInduit Then Exit Sub
Minutes(ComboBox3) = Minutes(ComboBox1) + Minutes(ComboBox2)
End Sub
Private Sub ComboBox2_Change()
If ChangementInduit Then Exit Sub
Minutes(ComboBox3) = Minutes(ComboBox1) + Minutes(ComboBox2)
End Sub
Private Sub ComboBox3_Change()
If ChangementInduit Then Exit Sub
Minutes(ComboBox2) = Minutes(ComboBox3) - Minutes(ComboBox1)
End Sub
Property Get Minutes(ByVal CBx As MSForms.ComboBox) As Long
On Error Resume Next
Minutes = Int(CDate(CBx.Text) * 1440 + 0.5)
End Property
Property Let Minutes(ByVal CBx As MSForms.ComboBox, M As Long)
ChangementInduit = True
If M < 0 Then M = M + 1440
CBx.Text = Format(M / 1440, "hh:mm")
ChangementInduit = False
End Property