C
CG Rosén
Good Day Group,
Found below code in this group. It works fine except that the SetFocus
command does not work.
The focus jumps to TextBox2 as set in the "Tab order".
What Iám looking for is a code that validates the TextBox and give a warning
when a letter is entered
in the box, single or mixed with numbers. Only numbers ín any combination
shall be the correct input.
Grateful for help.
Brgds
CG Rosén
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1.TextLength = 0 Then
Cancel = True 'to prevent non-entry
Else
With Sheet1.Range("c1:c99")'Where valid entries are located
Set c = .Find(TextBox1.Text)
If c Is Nothing Then
MsgBox TextBox1.Text & " is invalid input"
TextBox1.SetFocus
Exit Sub
End If
End With
End If
End Sub
Found below code in this group. It works fine except that the SetFocus
command does not work.
The focus jumps to TextBox2 as set in the "Tab order".
What Iám looking for is a code that validates the TextBox and give a warning
when a letter is entered
in the box, single or mixed with numbers. Only numbers ín any combination
shall be the correct input.
Grateful for help.
Brgds
CG Rosén
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1.TextLength = 0 Then
Cancel = True 'to prevent non-entry
Else
With Sheet1.Range("c1:c99")'Where valid entries are located
Set c = .Find(TextBox1.Text)
If c Is Nothing Then
MsgBox TextBox1.Text & " is invalid input"
TextBox1.SetFocus
Exit Sub
End If
End With
End If
End Sub