ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code Question (https://www.excelbanter.com/excel-programming/340960-code-question.html)

Ronbo

Code Question
 
What is wrong with this simple code. It always returns "equals"?

Private Sub Worksheet_Activate()
If H20 < I20 Then MsgBox "does not equal" Else _
MsgBox "equals"



End Sub

Thanks

JMB

Code Question
 
I think excel is treating H20 and I20 as variables (whose values are both
zero).
Try:

If Range("H20").Value < Range("I20").Value

"Ronbo" wrote:

What is wrong with this simple code. It always returns "equals"?

Private Sub Worksheet_Activate()
If H20 < I20 Then MsgBox "does not equal" Else _
MsgBox "equals"



End Sub

Thanks


Ronbo

Code Question
 
Thanks, it works perfect.

"JMB" wrote:

I think excel is treating H20 and I20 as variables (whose values are both
zero).
Try:

If Range("H20").Value < Range("I20").Value

"Ronbo" wrote:

What is wrong with this simple code. It always returns "equals"?

Private Sub Worksheet_Activate()
If H20 < I20 Then MsgBox "does not equal" Else _
MsgBox "equals"



End Sub

Thanks


JMB

Code Question
 
you're welcome.

"Ronbo" wrote:

Thanks, it works perfect.

"JMB" wrote:

I think excel is treating H20 and I20 as variables (whose values are both
zero).
Try:

If Range("H20").Value < Range("I20").Value

"Ronbo" wrote:

What is wrong with this simple code. It always returns "equals"?

Private Sub Worksheet_Activate()
If H20 < I20 Then MsgBox "does not equal" Else _
MsgBox "equals"



End Sub

Thanks



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

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