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.

Flashing Cells

Written by Allen Wyatt (last updated April 28, 2018)
This tip applies to Excel 97, 2000, 2002, and 2003


10

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:

  1. Select the cell that you want to flash on and off.
  2. Choose Style from the Format menu. Excel displays the Style dialog box. (See Figure 1.)
  3. Figure 1. The Style dialog box.

  4. In the Style Name box, enter a new style name. (For this example, use the style name Flashing.)
  5. Using the controls in the dialog box, modify any attributes for the style, as you desire.
  6. Click on OK.

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:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

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.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Punctuation Marks that Don't End Sentences

Word tries its best to recognize when you've reached the end of a sentence and then helpfully capitalizes the first ...

Discover More

Detecting Types of Sheets in VBA

When processing workbook information in a macro, you may need to step through each worksheet to make some sort of ...

Discover More

Sorting Dates by Month

Sorting by dates is easy, and you end up with a list that is in chronological order. However, things become a bit more ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (menu)

Custom Formats for Scientific Notation

Excel allows you to format your numeric values in a wide variety of ways. One such formatting option is to display ...

Discover More

Understanding Color and Conditional Formatting Codes

When you create custom cell formats, you can include codes that allow you to set the color of a cell and that specify the ...

Discover More

Displaying Latitude and Longitude

If you work with geographic data, you may need a way to display latitude and longitude in a worksheet. This tip examines ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 1 + 1?

2020-03-27 02:11:46

Roger Bertrand

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

Barry

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

Barry

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

Barry

@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

Barry

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.


This Site

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.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.