I'm trying to validate that the value of a textbox is a percentage. I use IsNumeric and IsEmpty for other textboxes, but there doesn't appear to be a IsPercentage function that I can use. I'm horrible with everything related to Math, so I'm not sure if I need to do some sort of equation to determine if the textbox is formatted as a percentage or not.
Here's the code that turns the value into a percentage.
I need to verify that the value is a percentage when the EU clicks a command button, so that some other value doesn't map over to the destination sheets.
Thoughts?
Here's the code that turns the value into a percentage.
Code:
Private Sub txt_BodyFat_Exit(ByVal cancel As MSForms.ReturnBoolean)'Formats the field as a percentage.
If Not Len(Me.txt_BodyFat.Value) = 0 And IsNumeric(Me.txt_BodyFat.Value) Then
Me.txt_BodyFat = Format(Val(Me.txt_BodyFat) / 100, ".#0%")
Else
MsgBox "Please enter a valid Body Fat value, using numbers only."
End If
End Sub
I need to verify that the value is a percentage when the EU clicks a command button, so that some other value doesn't map over to the destination sheets.
Thoughts?