wait function

  • Thread starter Thread starter N+
  • Start date Start date
N

N+

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top