I have written some code to validate that a user input field contains a whole number;
If VarType(Range("Quantity1")) = vbInteger Then
Else: MsgBox "Quantity must be a whole number, to rectify this please enter a whole number in the quantity field.", vbCritical, "Operator Response Required"
Range("Quantity1").ClearContents
Range("Quantity1").Select
Exit Sub
End If
This code returns an error message regardless of Quantity1 having an integer or not.
Can anyone help with this?
Quantity1 is the name of the cell to be validated.
Bookmarks