Some potential problems I can see:
This can never be true, as "now" will always be "now"! So the loop should run forever.
Perhaps what you're intending would be more like:
However, assuming that your macro isn't changing the colours at all (rather than just not stopping after a minute), there's clearly something else wrong...
Macro code takes time to execute. Not much time, but your method relies on it executing the following line exactly on a round second:
If its a fraction of a millisecond either way, the colour won't change!
I think your best option is with nested loops, and checking whether "now" exceeds a calculated time (as in my suggested code above) rather than matching it exactly. For example:
There will always be the issue of what happens if the colour change code takes more than a second to execute.
With my code above, the process will still stop after a minute - if the code runs slowly, you won't get the full 60 changes. At best you're only likely to get 59, as the 60th would be fractionally outside the one minute. If a full 60 changes is more important than the total run time, suggest that you change the outer loop to one woth a basic counter so that it just runs 60 times.
Bookmarks