I need to compare two user inputs. If the second input is greater than the first, I want an error box to pop up and for it to clear out the input boxes forcing the user to input different values. This is the code I am trying to use right now. It's odd because if I input 10000 and 1000 in the boxes the code works, but if I input 10000 and 2000 it doesn't work. The error box pops up even though 2000 is not greater than 10000
Private Sub TextBox2_Change()
Dim answer As String
With TextBox2
If TextBox2.Value > TextBox1.Value Then
answer = MsgBox("The 2nd input can not be greater than the 1st input" & vbNewLine & "Please modify your input", vbOKOnly + vbCritical, "ERROR")
TextBox1.Value = ""
TextBox2.Value = ""
End If
End With
End Sub
thanks!!
CMS
Private Sub TextBox2_Change()
Dim answer As String
With TextBox2
If TextBox2.Value > TextBox1.Value Then
answer = MsgBox("The 2nd input can not be greater than the 1st input" & vbNewLine & "Please modify your input", vbOKOnly + vbCritical, "ERROR")
TextBox1.Value = ""
TextBox2.Value = ""
End If
End With
End Sub
thanks!!
CMS