کد:
Private Sub TextBox11_Change()
x = Left(TextBox11.Text, 2)
Z = Right(TextBox11.Text, 2)
a = Len(TextBox11.Text)
Select Case a
Case 0
Case 1 To 2
If IsNumeric(x) And x <= 24 And Mid(x, 2, 1) <> "+" Then
Else
MsgBox "Ïæ ÑÞã Çæá ÈÇíÏ ÚÏÏ ÈÇÔÏ , æ ˜ãÊÑ ÇÒ 24", vbInformation
TextBox11.Text = ""
End If
Case 3
TextBox11.Text = WorksheetFunction.Replace(TextBox11.Text, 3, 1, "+")
Case 4 To 5
If IsNumeric(Z) And Z <= 24 Then
Else
MsgBox "Ïæ ÑÞã ÇÎÑ ÈÇíÏ ÚÏÏ ÈÇÔÏ, æ ˜ãÊÑ ÇÒ 24", vbInformation
TextBox11.Text = WorksheetFunction.Replace(TextBox11.Text, 4, 2, "")
End If
Case 6 To 7
TextBox11.Text = WorksheetFunction.Replace(TextBox11.Text, 6, 1, "")
End Select
End Sub
