"IF loop not working in EXCEL Macros"
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 displa开发者_如何学运维yed.
Can anyone pls help.
Reagrds
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
精彩评论