Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default 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
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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor [email protected] Excel Programming 2 March 30th 07 07:48 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 07:18 AM.

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"