Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default 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
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
Command button continues to be visible! CAPTGNVR[_2_] Excel Programming 11 October 8th 08 05:18 PM
Fails then continues without error Joel Excel Programming 6 September 23rd 08 08:39 AM
=OFFSET(MATCH(My frustration continues!)) Confused Excel Programming 1 July 18th 08 08:31 AM
Formula Bar continues to move Kentle Excel Discussion (Misc queries) 0 November 2nd 06 02:33 PM
CheckSpelling Method Continues beyond specified range greggmendel Excel Programming 1 October 22nd 04 01:50 AM


All times are GMT +1. The time now is 03:08 PM.

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

About Us

"It's about Microsoft Excel"