How to Highlight / Flash Cell Contents of Excel Files using Macros

If you have certain data in MS Excel cells that needs to be highlighted and brought attention to, merely changing its font attributes may not always serve the purpose. You can try some simple macros to make your cell contents flash instead. First you need to define a cell style. To do so, carry out the following steps:

Defining a Cell Style

  • Go to the ‘Home’ tab.
  • Click the ‘Cell Styles’ option appearing under the ‘Styles’ group.
  • Click the ‘New Cell Style’ button appearing at the base of the drop down list.
  • Set the ‘Style Name:’ value as ‘flashing’, and set the attribute values as required.
  • Click ‘OK’ to create the cell style.
  • Next, select the cells to which the cell style is to be applied.
  • Click the ‘Cell Styles’ option appearing under the ‘Styles’ group of the ‘Home’ tab.
  • Select the newly created ‘flashing’ style.
  • Next, go to the ‘Developer’ tab.

NOTE: If you cannot find this tab, click the ‘Office’ button, click the ‘Excel Options’ button and check the ‘Show Developer tab in the Ribbon’ option.

Creating a Macro to Highlight or Flash Excel Cell Contents

  • Click the ‘Visual Basic’ option under the ‘Code’ group of the tab.
  • Right-click on the ‘Module’ component in the ‘Visual Basic’ editor window.
  • Select ‘Insert > Module’ from the context menu.

Create macros to highlight or flash excel cell contents

  • In the module window, type the two following macros.

Dim NextTime As Date
Sub StartFlash()
NextTime = Now +
With ActiveWorkbook.
If .ColorIndex =
xlAutomatic Then
.ColorIndex = 3
.ColorIndex = 5 –
End With
Application.OnTime NextTime,
End Sub

Sub StopFlash()
NextTime, ‘StartFlash’,
ColorIndex = xlAutomatic
End Sub

  • To start the effect, click the ‘Macro’ option under the ‘Code’ group of the tab.
  • Select ‘StartFlash’ and click ‘Run’. The contents will appear in red and white color in a span of one second each.
  • To stop the effect, Select ‘StopFlash’ and click ‘Run’.

This simple tip will make your cell contents look different and will help in grabbing attention. If you know any better ways to improve excel features, Feel free to share with is.

Filed under: Tips n Tricks
Tags: , , , ,
March 11, 2011 by: Prasanth Chandra

Leave a Reply