ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   wait function (https://www.excelbanter.com/excel-programming/405866-wait-function.html)

N+

wait function
 
hi all, i need to make this loop for a macro with a wait function that avoid
the cpu to go 100%

loop
.... .. .. .. ..
... .. . . ...
while A1=ON


ty if u can help me

Gary''s Student

wait function
 
Let's take your code and split it into two parts:

1. Macro1 that is run before the "wait"
2. Macro2 that will be run after the "wait"
3. Include an Event macro ( either Change or Calculate) to monitor cell A1

3a. Set Application.EnableEvents=False
3b. Run Macro1 - the last thing Macro1 does is to EnableEvents and then exit
3c. The Event macro will detect the A1 < ON occurance
3d. The Event Macro will call Macro2

The "wait" happens without VBA spinning in a loop

--
Gary''s Student - gsnu200768


"N+" wrote:

hi all, i need to make this loop for a macro with a wait function that avoid
the cpu to go 100%

loop
... .. .. .. ..
.. .. . . ...
while A1=ON


ty if u can help me


N+

wait function
 
do while...

...loop !!
ty p im gonna work on it !



"Gary''s Student" wrote:

Let's take your code and split it into two parts:

1. Macro1 that is run before the "wait"
2. Macro2 that will be run after the "wait"
3. Include an Event macro ( either Change or Calculate) to monitor cell A1

3a. Set Application.EnableEvents=False
3b. Run Macro1 - the last thing Macro1 does is to EnableEvents and then exit
3c. The Event macro will detect the A1 < ON occurance
3d. The Event Macro will call Macro2

The "wait" happens without VBA spinning in a loop

--
Gary''s Student - gsnu200768


"N+" wrote:

hi all, i need to make this loop for a macro with a wait function that avoid
the cpu to go 100%

loop
... .. .. .. ..
.. .. . . ...
while A1=ON


ty if u can help me



All times are GMT +1. The time now is 05:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com