Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code question peyman Excel Discussion (Misc queries) 5 February 5th 09 12:04 AM
question on VB code peyman Excel Discussion (Misc queries) 6 October 22nd 07 11:47 PM
code question Gary Keramidas[_2_] Excel Programming 16 July 19th 05 05:13 PM
Please help with vba code question Temp12 Excel Programming 2 July 14th 04 09:31 PM
VBA CODE Question Gary[_5_] Excel Programming 2 July 29th 03 03:45 AM


All times are GMT +1. The time now is 01:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"