Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Flashing Cells.
Written by Allen Wyatt (last updated April 28, 2018)
This tip applies to Excel 97, 2000, 2002, and 2003
Many people use the conditional formatting features of Excel to draw attention to specific values or areas of their worksheets. For instance, a cell might be formatted so that its contents are displayed in red or in boldface if above or below a certain threshold.
What is missing, however, is a way to make the contents of a cell flash, or blink on and off. For such a feat, you are left to your own devices and the miracle of macros. By utilizing these tools, you can make cells blink by first designing a special style for the blinking cells, and then running a simple macro.
To create the special style, follow these steps:
Figure 1. The Style dialog box.
You can now apply the style to any other cells you desire in your workbook. Now create the macros (there are two of them), as follows:
Dim NextTime As Date Sub StartFlash() NextTime = Now + TimeValue("00:00:01") With ActiveWorkbook.Styles("Flashing").Font If .ColorIndex = xlAutomatic Then .ColorIndex = 3 .ColorIndex = 5 - .ColorIndex End With Application.OnTime NextTime, "StartFlash" End Sub Sub StopFlash() Application.OnTime NextTime, "StartFlash", schedule:=False ActiveWorkbook.Styles("Flashing").Font.ColorIndex = xlAutomatic End Sub
To start the items flashing, simply run StartFlash. The cells formatted with the Flashing style will alternate between red and white text approximately once a second. When you want to turn the flashing off, simply run the StopFlash macro.
There is one important thing to note about this macro: the variable NextTime is declared outside of the actual procedure in which it is used. This is done so that NextTime maintains its value from one invocation of StartFlash to the next.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2134) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Flashing Cells.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
Want to apply a custom format to your dates and times? To do it effectively you need to understand the custom formatting ...
Discover MoreIt's easy to automatically set the contents of one cell to be equal to another cell. But what if you want to copy the ...
Discover MoreWhen you create custom formats for your data, Excel provides quite a few ways you can make that data look just as you ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-03-27 02:11:46
It jammed my Excel... does not work well.
2020-01-27 16:38:24
TOM
Hello,
what if I want to have flashing cell only if other cell is not empty?
2019-04-19 04:29:26
if you want cells to start flashing automatically form when the workbook opens you can put this in the "ThisWorkbook" codepage
Private Sub Workbook_Open ()
StartFlash
End sub
2019-04-18 02:58:41
To start the items flashing, simply run StartFlash. The cells formatted with the Flashing style will alternate between red and white text approximately once a second. When you want to turn the flashing off, simply run the StopFlash macro
2019-04-17 10:53:34
Dan
Hello, what triggers the procedures ? On enter ? on After Update on exit ? else ?
2019-01-29 03:51:42
@Brandon
You don't say what version of Excel you are running but as this Tip is in the older 'menu' interface (i.e. Excel 2003 and previous) I'll assume this. Excel can be quite fickle about security.
It is most likely that macros are disabled as it is naming "StartFlashing" so I suggest you try setting your macro security to Medium to see if that fixes the issue (High and Very High require macros to be digitally signed). Choose enable macros when prompted
If you're using Excel 2007 or later you can try making the folder in which you are storing the workbook to a "Trusted Location" , do this through the Trust Center.
2019-01-28 10:29:41
Brandon C.
I'm trying to do this, but I keep getting the following error:
"Cannot run the macro "...StartFlashing". The macro may not be available in this workbook or all macros may be disabled."
I have gone through the Trust Center to enable 'Trust access to the VBA project object model' as recommended from various forums, but I just can't seem to get this to work. I have another macro enable in the workbook and on this particular sheet, but I can't seem to get this one to work. 😫
2018-11-08 04:08:26
Barry
@Alana
My saample code given in the tip: https://excelribbon.tips.net/T007223_Flashing_Cells.html on 5th May 2016 does exactly what you want (theres' even a sample workbook you can download). You must ensure macros are enabled.
Although shown in the Excel 2007 and later they work in earlier versions of Excel as well.
2018-11-07 16:23:01
Alana
Allen, is there a way to use the Flashing Macro with Conditional Formatting. For example: Flashing formatting applies to a cell with warning, when the value of a different cell exceeds a named parameter. =$B$10>0 Applies to Cells $B$2:$B$9 Format = "Flashing"
2018-04-28 05:25:17
You have to be careful that you do not get the Run-Time Error "9" saying "Subscript out of Range" on the ".ColorIndex = 5 - .ColorIndex" statement in the macro. You'll get this if the "5 - .Colorindex" is an invalid value (e.g. negative).
Other ways of flashing cells are given in tip: https://excelribbon.tips.net/T007223_Flashing_Cells.html although shown in the Excel 2007 and later they work in earlier versions of Excel as well.
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments