Hi guys,
I have this code that checks that my TextBox is not empty, and also formats it. But when one tabs through the field, a warning does pop up, but the cursor moves to the next field. How can I change/force the focus to that field until an input has been made?
i have tried SetFocus
Here is my code:
Private Sub txtStockSOS1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsNumeric(txtStockSOS1.Value) And txtStockSOS1.Value <> vbNullString Then
MsgBox "Sorry, only numbers allowed"
txtStockSOS1.Value = vbNullString
'Me.txtStockSOS1.SetFocus
Else
txtStockSOS1.Value = Format(txtStockSOS1.Value, "#,##0.00")
End If
End Sub
Thank you!
Bookmarks