As part of a UserForm I am Validating and Formatting in one pass. The problem I'm having is that when the Validation fails, I get the error message, and the focus moves on to the next text box.
I want to trap the user in a loop until they have acceptable data
Private Function CheckNum2(CurValue As String)
On Error Resume Next
Select Case True
Case IsNumeric(CurValue)
CheckNum2 = Format$(CurValue, "#,###.##")
Case CurValue < 1
MsgBox ("You must set a value of 1 or greater")
Case Else
MsgBox ("You must set a value of 1 or greater")
End Select
End Function
Private Sub APV_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With APV
.Text = CheckNum2(.Text)
End With
End Sub
Bookmarks