Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro continues to run
Hi,
The following code works well with the exception that when the Message Box appears and the cursor is moved off the Message Box on to the worksheet the hour glass appears instead of the mouse pointer. I presume this means that the macro is still running. Sub CheckVolumeRise1() If Range("g6") < Range("h6") < Range("k6") Then MsgBox Range("a6") & " has reached criteria" End If End Sub Please will someone advise me on what to do. Thank you. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro continues to run
I ran this code and I didn't see any hourglass at all. I'm not sure
why the hour glass is appearing in your case. BTW, is it okay in VBA to use the less than operator like that ('If Range("g6") < Range("h6") < Range("k6") Then')?? I thought you had to use the AND operator between those, such ast he following: If (Range("g6") < Range ("h6")) AND (Range("h6") < Range("k6")) then ' Do stuff here End If Also, you you trying to compare a range or are you trying to compare the values inside those cell ranges??? If you are comparing cell contents, shouldn't you use: Range("g6").value ' etc, etc... ???? Robert "Rob" wrote in message ... Hi, The following code works well with the exception that when the Message Box appears and the cursor is moved off the Message Box on to the worksheet the hour glass appears instead of the mouse pointer. I presume this means that the macro is still running. Sub CheckVolumeRise1() If Range("g6") < Range("h6") < Range("k6") Then MsgBox Range("a6") & " has reached criteria" End If End Sub Please will someone advise me on what to do. Thank you. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro continues to run
"Rob" wrote in message ... Hi, The following code works well with the exception that when the Message Box appears and the cursor is moved off the Message Box on to the worksheet the hour glass appears instead of the mouse pointer. I presume this means that the macro is still running. Sub CheckVolumeRise1() If Range("g6") < Range("h6") < Range("k6") Then MsgBox Range("a6") & " has reached criteria" End If End Sub Please will someone advise me on what to do. Thank you. Rob, You are correct. Until you click a button in the message box, in your case the 'OK' button, the macro is still running. You see the hourglass because it is awaiting a reply to the message box. Once you click a button in the message box, the code resumes at the line immediately following the MsgBox line. An option to avoid having to click a button in the message box is to create a userform or a textbox and make it visible for a few seconds and then hide it. This way your code can continue uninterrupted without requiring user input of any kind. HTH, Bonnie |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro continues to run
"Robert Crandal" wrote in message ... I ran this code and I didn't see any hourglass at all. I'm not sure why the hour glass is appearing in your case. BTW, is it okay in VBA to use the less than operator like that ('If Range("g6") < Range("h6") < Range("k6") Then')?? I thought you had to use the AND operator between those, such ast he following: If (Range("g6") < Range ("h6")) AND (Range("h6") < Range("k6")) then ' Do stuff here End If Also, you you trying to compare a range or are you trying to compare the values inside those cell ranges??? If you are comparing cell contents, shouldn't you use: Range("g6").value ' etc, etc... ???? Robert, Although, it is good practice to specify *exactly* what is being compared, I believe .Value is the default property of a range object. To compare something other than the range value, that property (eg: Range("G6").Address) would have to be explicitly coded. I hope others will weigh in if I am incorrect. Bonnie |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro continues to run
Hi Robert,
Thanks for your help. I am a brand newbie at this VBA programming. So in answer to your questions. I really would not know. Regards, Rob. "Robert Crandal" wrote: I ran this code and I didn't see any hourglass at all. I'm not sure why the hour glass is appearing in your case. BTW, is it okay in VBA to use the less than operator like that ('If Range("g6") < Range("h6") < Range("k6") Then')?? I thought you had to use the AND operator between those, such ast he following: If (Range("g6") < Range ("h6")) AND (Range("h6") < Range("k6")) then ' Do stuff here End If Also, you you trying to compare a range or are you trying to compare the values inside those cell ranges??? If you are comparing cell contents, shouldn't you use: Range("g6").value ' etc, etc... ???? Robert "Rob" wrote in message ... Hi, The following code works well with the exception that when the Message Box appears and the cursor is moved off the Message Box on to the worksheet the hour glass appears instead of the mouse pointer. I presume this means that the macro is still running. Sub CheckVolumeRise1() If Range("g6") < Range("h6") < Range("k6") Then MsgBox Range("a6") & " has reached criteria" End If End Sub Please will someone advise me on what to do. Thank you. . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro continues to run
Hi Bonnie,
Thanks for your help. Regards, Rob. "Bonnie" wrote: "Rob" wrote in message ... Hi, The following code works well with the exception that when the Message Box appears and the cursor is moved off the Message Box on to the worksheet the hour glass appears instead of the mouse pointer. I presume this means that the macro is still running. Sub CheckVolumeRise1() If Range("g6") < Range("h6") < Range("k6") Then MsgBox Range("a6") & " has reached criteria" End If End Sub Please will someone advise me on what to do. Thank you. Rob, You are correct. Until you click a button in the message box, in your case the 'OK' button, the macro is still running. You see the hourglass because it is awaiting a reply to the message box. Once you click a button in the message box, the code resumes at the line immediately following the MsgBox line. An option to avoid having to click a button in the message box is to create a userform or a textbox and make it visible for a few seconds and then hide it. This way your code can continue uninterrupted without requiring user input of any kind. HTH, Bonnie |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Command button continues to be visible! | Excel Programming | |||
Fails then continues without error | Excel Programming | |||
=OFFSET(MATCH(My frustration continues!)) | Excel Programming | |||
Formula Bar continues to move | Excel Discussion (Misc queries) | |||
CheckSpelling Method Continues beyond specified range | Excel Programming |