Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim L As Long
L = Text1.SelStart
If L < 18 Then
If KeyAscii = 8 Then Exit Sub
If L Mod 3 = 2 Then
If KeyAscii <> Asc("-") Then KeyAscii = 0
Else
If Not ((Asc("0") <= KeyAscii And KeyAscii <= Asc("9")) Or (Asc("A") <= KeyAscii And KeyAscii <= Asc("F")) Or (Asc("a") <= KeyAscii And KeyAscii <= Asc("f"))) Then
KeyAscii = 0
Else
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End If
End If
Else
If KeyAscii <> 13 And KeyAscii <> 8 Then KeyAscii = 0
End If
End Sub