austin350s10
Active Member
- Joined
- Jul 30, 2010
- Messages
- 321
I have been using the following code to only allow the user to enter numbers into a text box on a userform. I am needing to use a similar code to this on a named range to restrict the user from entering certain characters. I am not too sure how to manipulate the following code to make it work on a named range...
Does anyone know how to completely block particular characters from being typed into a named range?
Code:
Private Sub txtFax_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If InStr("0123456789.", Chr(KeyAscii)) = 0 Then KeyAscii = 0
End Sub