Try this,
Private Sub TextBox1_Change()
If Len(TextBox1) = 3 Then TextBox1 = TextBox1 & "-"
If Len(TextBox1) = 7 Then TextBox1 = TextBox1 & "-"
If Len(TextBox1) = 12 Then MsgBox "Enough Already": TextBox2.SetFocus'goes to the next textbox when enough numbers are entered
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc("0") To Asc("9")
Case Else
KeyAscii = 0
End Select
End Sub
The keypress code can be found here for additional details
http://www.cpearson.com/excel/TextBox.htm
Bookmarks