I have a problem with my macro that runs in UserForm and I would also like to apply it to sheet1 in textBox active controls. I have a question how to change the code to work in sheat1?
Option Explicit
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If Not IsNumeric(Chr(KeyAscii)) And Not KeyAscii = 8 Then
KeyAscii = 0
End If
End Sub
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1.Value = "" Then
Exit Sub
End If
If Val(TextBox1.Text) < 100 Or Val(TextBox1.Text) > 999 Then
MsgBox "Error"
Cancel = True
End If
End Sub
Private Sub UserForm_Click()
End Sub
Bookmarks