Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with macro?
Here is the macro code:
Dim SCell As Integer Do Until SCell.Value = 1 If SCell.Value < 1 Then Range("J24").Select Calculate End If Loop where SCell checks a condition like this: "if(A2A3,1,0)" and A2 has RAND in it so everytime sheet is calculated by changing RAND, SCell's condition is checked. The macro's loop might runs one time or 500 times but it must stop when SCell=1 Thanks, Jo |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with macro?
Probably should be
Dim SCell As Integer Do Until Activeell.Value = 1 If Activecell.Value < 1 Then Range("J24").Select Calculate End If Loop -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jo" wrote in message ups.com... Here is the macro code: Dim SCell As Integer Do Until SCell.Value = 1 If SCell.Value < 1 Then Range("J24").Select Calculate End If Loop where SCell checks a condition like this: "if(A2A3,1,0)" and A2 has RAND in it so everytime sheet is calculated by changing RAND, SCell's condition is checked. The macro's loop might runs one time or 500 times but it must stop when SCell=1 Thanks, Jo |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with macro?
On Oct 4, 1:28 pm, "Bob Phillips" wrote:
Probably should be Dim SCell As Integer Do Until Activeell.Value = 1 If Activecell.Value < 1 Then Range("J24").Select Calculate End If Loop -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jo" wrote in message ups.com... Here is the macro code: Dim SCell As Integer Do Until SCell.Value = 1 If SCell.Value < 1 Then Range("J24").Select Calculate End If Loop where SCell checks a condition like this: "if(A2A3,1,0)" and A2 has RAND in it so everytime sheet is calculated by changing RAND, SCell's condition is checked. The macro's loop might runs one time or 500 times but it must stop when SCell=1 Thanks, Jo- Hide quoted text - - Show quoted text - It is working but it is NOT stopping when SCell is 1?! What could be missing? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with macro?
I put RAND in A2, 3 in A3, and =IF(A2A3,1,0) in J24. SCell value
remains at 0. It appears never to reach 1. On Oct 4, 10:38 am, Jo wrote: On Oct 4, 1:28 pm, "Bob Phillips" wrote: Probably should be Dim SCell As Integer Do Until Activeell.Value = 1 If Activecell.Value < 1 Then Range("J24").Select Calculate End If Loop -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jo" wrote in message oups.com... Here is the macro code: Dim SCell As Integer Do Until SCell.Value = 1 If SCell.Value < 1 Then Range("J24").Select Calculate End If Loop where SCell checks a condition like this: "if(A2A3,1,0)" and A2 has RAND in it so everytime sheet is calculated by changing RAND, SCell's condition is checked. The macro's loop might runs one time or 500 times but it must stop when SCell=1 Thanks, Jo- Hide quoted text - - Show quoted text - It is working but it is NOT stopping when SCell is 1?! What could be missing? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with macro?
There are some things that I'm not following
: Dim SCell As Integer : : Do Until SCell.Value = 1 So the above says to do this loop until the value of SCell = 1 : If SCell.Value < 1 Then Why would you need this line, the loop requirement above says that SCell < 1 or we would not execute the loop : Range("J24").Select So if SCell value < 1 (requirement to be in loop) then select Range ("J24"). Seems like everytime you run the loop, you are selecting the same cell : Calculate : End If : Loop If you just want to loop till you hit 1, this should work. If there is something else you are trying to do, then this will need to be modified Dim SCell As Integer Range("J24").Select Do Until SCell.Value = 1 Calculate Loop Paul D "Jo" wrote in message ups.com... : Here is the macro code: : : Dim SCell As Integer : : Do Until SCell.Value = 1 : If SCell.Value < 1 Then : : Range("J24").Select : Calculate : End If : Loop : : where SCell checks a condition like this: "if(A2A3,1,0)" and A2 has : RAND in it so everytime sheet is calculated by changing RAND, SCell's : condition is checked. The macro's loop might runs one time or 500 : times but it must stop when SCell=1 : : Thanks, : Jo : |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with macro?
On Oct 4, 1:51 pm, dan dungan wrote:
I put RAND in A2, 3 in A3, and =IF(A2A3,1,0) in J24. SCell value remains at 0. It appears never to reach 1. On Oct 4, 10:38 am, Jo wrote: On Oct 4, 1:28 pm, "Bob Phillips" wrote: Probably should be Dim SCell As Integer Do Until Activeell.Value = 1 If Activecell.Value < 1 Then Range("J24").Select Calculate End If Loop -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jo" wrote in message oups.com... Here is the macro code: Dim SCell As Integer Do Until SCell.Value = 1 If SCell.Value < 1 Then Range("J24").Select Calculate End If Loop where SCell checks a condition like this: "if(A2A3,1,0)" and A2 has RAND in it so everytime sheet is calculated by changing RAND, SCell's condition is checked. The macro's loop might runs one time or 500 times but it must stop when SCell=1 Thanks, Jo- Hide quoted text - - Show quoted text - It is working but it is NOT stopping when SCell is 1?! What could be missing?- Hide quoted text - - Show quoted text - Trust me, I didn't post the example I have as it is but just something simple to make my point. Actually, in my application, the if-condition gets satisfied every # of times as I see it but want the macro to STOP when SCell gets 1! With your code, I can see SCell is hitting one but it keeps running! What do you think I should add to the code? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor | Excel Programming | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |