View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Shawn Shawn is offline
external usenet poster
 
Posts: 271
Default limit textbox to blank or exactly 4 numberic digits

This works

Private Sub txtbxPhonePost_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If txtbxPhonePost.Value = "" Then
usfDemo.cmbxDOBMonth.SetFocus
Else
If IsNumeric(usfDemo.txtbxPhonePost.Text) = False Then
MsgBox "This box must be blank or contain exactly 4 numbers!",
vbOKOnly
Else
If Len(usfDemo.txtbxPhonePost.Text) < 4 Then
MsgBox "This box must be blank or contain exactly 4
numbers!", vbOKOnly
End If
End If
End If
End Sub

Is there a better way?
--
Thanks
Shawn