ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   If/Then - EASY (https://www.excelbanter.com/excel-discussion-misc-queries/217352-if-then-easy.html)

JRW6277

If/Then - EASY
 
I have the following If/Then statement in a macro, the problem is when the
value of the K9 is less than 10 it isn't identified correctly by the if
statement. Is there some easy fix like changing the number format I'm
missing?

If Range("K9") < "37.5" Then
Call Message
Else
Call Macro1
End If

Bob Alhat

If/Then - EASY
 
Your macro is testing for text. To test for a number you need:

If Range("K9") < 37.5 Then


HTH
Bob

"JRW6277" wrote in message
...
I have the following If/Then statement in a macro, the problem is when the
value of the K9 is less than 10 it isn't identified correctly by the if
statement. Is there some easy fix like changing the number format I'm
missing?

If Range("K9") < "37.5" Then
Call Message
Else
Call Macro1
End If



JRW6277

If/Then - EASY
 
I knew is was something silly like that. Thanks Bob

"Bob Alhat" wrote:

Your macro is testing for text. To test for a number you need:

If Range("K9") < 37.5 Then


HTH
Bob

"JRW6277" wrote in message
...
I have the following If/Then statement in a macro, the problem is when the
value of the K9 is less than 10 it isn't identified correctly by the if
statement. Is there some easy fix like changing the number format I'm
missing?

If Range("K9") < "37.5" Then
Call Message
Else
Call Macro1
End If




All times are GMT +1. The time now is 05:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com