Need code for having a keystroke stop the main code

kualjo

Board Regular
Joined
Aug 15, 2006
Messages
106
I need to have a cell flash back and forth between colors and continue to do so until the Enter key is pressed. I've seen this before, but can't remember how it goes. The code is just a simple loop that counts to a certain number, changes the cell color, starts the count over, changes the color back, then repeats until you hit Enter. Also, it would be helpful to change the flash rate, to speed it up or slow it down; do certain loop counts equate to a specific amount of time? Appreciate any help.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

RalphA

Well-known Member
Joined
May 14, 2003
Messages
3,829
If you have the code, then, it should be fairly simple to include, at the end of the loop, code that looks at the keyboard, and compares the current keypress with the ASCII code for Enter, which is 13, and, if so, to go to the end of the program. But, not being into VBA, I cannot help farther.
 

Forum statistics

Threads
1,136,696
Messages
5,677,259
Members
419,682
Latest member
M3one

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top