Reputation: 11
Private Sub CommandButton1_Click()
TextBox2.Value = 10
TextBox3.Value = 5
TextBox2.Value = (CInt(TextBox2))
TextBox3.Value = (CInt(TextBox3))
If TextBox2.Value > TextBox3.Value Then
ActiveSheet.Select
UserForm5.Show
End If
End Sub
The control is not going in the IF loop, and "USerForm5 is not getting displayed.
Can anyone pls help.
Reagrds
Upvotes: 1
Views: 123
Reputation: 613451
The comparison is being done as strings. Wrap the CInt()
calls around the values in the IF
statement and you'll be good.
TextBox2.Value = 10
TextBox3.Value = 5
If CInt(TextBox2.Value) > CInt(TextBox3.Value) Then
Upvotes: 4