creating a procedure(resolved)
Hey all.
I have this code to keep everything but numbers from being typed into a text box. (not mine) I have to call this code for several boxes. Instead of copy and pasting this several times I want to call it in a procedure. I created one but it didnot work. My guess is that I have to elaborate the procedure by passing something to it, like the key that was pressed instead of the number. Anyway, could somone help out if you understand. Thanks!
Code:
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii > 0 And KeyAscii <= 32) Or (KeyAscii > vbKey0 And KeyAscii <= vbKey9) Then
Exit Sub
Else
KeyAscii = 0
MsgBox "Please enter only numeric values"
End If