G
Guest
Hi all,
I use the following function to evaluate the contents of a text box on my
userform.
i want the code to allow either Numbic OR Null values. If the value in the
textbox is text, i want the system to fire a message stating the field does
not except text values.
Problem: This code does not allow the user to tab past an empty cell.
Instead, if the user doesn't provide a value, the message fires.
Can anyone assist with this one?
Function:
Public Function EvaluateText(anyEntry As String) _
As Boolean
EvaluateText = False ' all is well
If Not IsNumeric(anyEntry) Then
MsgBox "This field accepts numeric data only. Please revise your entry
and try again."
EvaluateText = True ' to be copied to Cancel
Exit Function ' exit with True
End If
End Function
On Exit Event of Textbox:
Private Sub txtPLSFlow_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Cancel = EvaluateText(Me!txtPLSFlow.Text)
End Sub
I use the following function to evaluate the contents of a text box on my
userform.
i want the code to allow either Numbic OR Null values. If the value in the
textbox is text, i want the system to fire a message stating the field does
not except text values.
Problem: This code does not allow the user to tab past an empty cell.
Instead, if the user doesn't provide a value, the message fires.
Can anyone assist with this one?
Function:
Public Function EvaluateText(anyEntry As String) _
As Boolean
EvaluateText = False ' all is well
If Not IsNumeric(anyEntry) Then
MsgBox "This field accepts numeric data only. Please revise your entry
and try again."
EvaluateText = True ' to be copied to Cancel
Exit Function ' exit with True
End If
End Function
On Exit Event of Textbox:
Private Sub txtPLSFlow_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Cancel = EvaluateText(Me!txtPLSFlow.Text)
End Sub