Loading
Excel.Tips.Net ExcelTips (Menu Interface)

Flashing Cells

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 if you are using Excel 2007:

  1. Select the cell that you want to flash on and off.
  2. Make sure the Home tab is displayed on the ribbon.
  3. In the Styles group, click Cell Styles. Excel displays a drop-down selections of pre-defined styles.
  4. Choose New Cell Style. Excel displays the Style dialog box. (See Figure 1.)
  5. Figure 1. The Style dialog box in Excel 2007.

  6. Using the controls in the dialog box, modify any attributes for the style, as you desire.
  7. Click on OK.

If you are using an older version of Excel, follow these steps instead:

  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 2.)
  3. Figure 2. The Style dialog box.

  4. In the Style Name box, enter a new style name, such as 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.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2134) applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003 | 2007

You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Flashing Cells.

Related Tips:

Your Data, Your Way! Want the greatest control possible over how your data appears on the page? Excel's custom formats can provide that control, and ExcelTips: Custom Formats can unlock the secrets to creating your own custom formats. Check out ExcelTips: Custom Formats today!

 

Comments for this tip:

Bharath    16 Apr 2013, 12:30
Hey Allen,

I tried your trick for the cell, it's working good.

I am trying the same to make the trends in the chart to blink if a given threshold exceeds. Is it possible.

example:

If the sales of my product in Newyork, sandiego increases more than 1000000$ the curves should blink after the exceeding point. Is this possible.

And is there any other way to achieve this other than writing Macros
Asher    29 Mar 2013, 19:22
I keep getting application or object defined error 1004 when the code gets to either:

Then .ColorIndex = 3

or when it gets to:

.ColorIndex = 5 - .ColorIndex

and sometimes I get an error 400 when it gets to this line:
.ColorIndex = 5 - .ColorIndex

... not sure why. The style is named correctly, there is a cell with that style applied to it.
Joe    20 Mar 2013, 17:19
Is there way of adjusting to the code to flash cells that are red.

I wrote a conditional formula to turn cells red if doesnt meet the formula.

Is there way of turning the flashing on when the tab is opened as well?
Jason    30 Jan 2013, 14:59
Nancy,

The error you are seeing is because you are trying to use the "Flashing" style when you probably saved the style as "Style 1" as the Excel 2007 instructions stated.
Nancy    30 Jan 2013, 12:49
With ActiveWorkbook.Styles("Flashing").Font


gave me an error of subscript out of range .... since I know nothing about macros, I can't solve the problem.

Leave your own comment:

*Name:
Email:
  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*Text:
*What is 2+3? (To prevent automated submissions and spam.)
 
 
 

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us

 

Advertise with Us

Our Privacy Policy

Our Sites

Tips.Net

Beauty and Style

Cars

Cleaning

Cooking

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2013)

Family

Gardening

Health

Home Improvement

Legal Help

Money and Finances

Organizing

Pests and Bugs

Pets and Animals

School and Schooling

Weddings

WindowsTips

WordTips (Word 97–2003)

WordTips (Word 2007–2013)

Our Products

Premium Newsletters

Helpful E-books

Newsletter Archives

 

Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2013 Sharon Parq Associates, Inc.