How to Flash an Excel Cell?

There are a variety of ways in Excel to let you highlight or draw attention to important information in your worksheet.

You can use highlights, make the font bolder, change the font color, and use conditional formatting.

But there might be times you want your reader’s eyes to get directly drawn to particular cells as soon as they open a document.

In this way, they don’t need to scour the entire document to find what you want them to find.

A lot of people like to make the contents of a cell flash. When a cell’s contents blink on and off, it makes the cell stand out from the rest (as shown below).

Flashing cell

In Microsoft Word, there’s a whole font style that lets you create blinking text. Unfortunately, there’s no menu item in Excel that lets you do this, but there’s a workaround.

In this tutorial, we will show you how to use VBA to flash a cell in Excel. If you’re new to macros and coding, you might have to get slightly out of your comfort zone.

We will try our best to make sure that it’s quick and painless though.

Using VBA to Flash a Cell in Excel

Excel macros provide excellent tools that let you do just about anything you want to do with your Excel sheets.

As such, if you need to make your cells blink, the best way to achieve it is by using macros coded in VBA.

Let’s say you want cell C8 (which is the grand total) in the dataset shown below to flash on and off:

Dataset where cell needs to be flashed

For this, there are a series of steps you need to follow. First, you need to decide what style you want for the cell contents when it blinks on.

You can think of changing the font color and/ or size, making it bolder or changing the cell background color.

Most people like to change the background color one and off, while others like to change the font size to make it alternate between looking bigger and smaller.

Once you have decided on the style you want, you can go ahead and create a Cell Style.

After that, you have to use Excel’s developer window to code your cell contents to flash on and off or alternatively change between two styles every second.

Creating a Cell Style

First things first, let us define a cell style. Excel lets you define your own custom styles that you can apply to any cell in your worksheet.

Cell styles let you apply different types of formatting to a cell in one step.

For example, say you want a cell to have a specific background color, a specific font size, type, and color, with specific borders.

You can get all this done in one step if you have a cell style defined with these settings.

There are a number of built-in styles already available that you can choose from, or you can customize and define your own.

To define your own cell style, follow these steps:

  1. Select the Home tab.
  2. Under the Style group, you will see a number of cell styles, like Normal, Bad, Good, etc. Click on the dropdown arrow to see more predefined styles.Click on the styles drop down
  3. Select the New Cell Style option.New Cell Styles
  4. This will open the Style dialog box.
  5. In the field next to Style Name, enter the name you want to give your custom style. In our example, we gave it the name “FlashingText”. Make sure you remember this name because you will be using this when you write your VBA code.Enter Style Name
  6. Click on the Format button just below the Style Name field.Click on Style format
  7. This will open the Format Cells dialog box, from where you can select whatever styling you want to give your cell (to highlight it).
  8. In our example, we set the Font color to “Red” and font style to “bold”, so if you want to do the same, select the Font tab and under Font style, select Bold.
  9. Similarly, click on the arrow next to “Color” and select the “red” color from the dropdown menu.Specify the cell formatting in which you want it to flash
  10. We also set the background color to a light salmon color. You can set it to any color you like. For this, you can select the Fill tab and select the background color of your choice.Select the background color
  11. You can add more styles and borders, alignment, etc. if you want.
  12. Once you have set all your style formats, click OK to close the Format Cells dialog box.
  13. You will see all your selected style settings in the Style dialog box now. Check if you have all your settings there.All the selected settings in the style dialog box
  14. Click OK to close the Style dialog box.
  15. You should see your custom format with its name displayed in the list of Styles under the Custom category.Formatting shows up as custom format

That’s it then, your style is ready. Now all you need to do is apply this style to any cells you want to flash!

Writing the VBA Code

Time to code! If you feel intimidated by the idea of coding, you really don’t have to. We’ve put together the code that you need:

Public NextTime As Double
Public Const FlashRng As String = "YourSheetName!C8"
Sub FlashCell()
If Range(FlashRng).Style = "FlashingText" Then
Range(FlashRng).Style = "Normal"
Range(FlashRng).Style = "FlashingText"
End If

NextTime = Now + TimeSerial(0, 0, 1)
Application.OnTime NextTime, "FlashCell", , True

End Sub

All you have to do is copy it and paste the above code in your developer window. Here’s how:

  1. From the Developer menu ribbon, select Visual Basic.
  2. Once your VBA window opens, you will see all your project files and folders in the Project Explorer on the left side. If you don’t see the Project Explorer, click on View->Project ExplorerProject explorer in the VB Editor
  3. Make sure your ‘ThisWorkbook’ is selected under the VBA project with the same name as your Excel workbook.Click on ThisWorkbook
  4. Click Insert->Module. You should see a new module window open up.
  5. Now you can start coding. Copy the above lines of code and paste them into the new module window.New module window
  6. Replace “YourSheetName” in line 2 with the name of the worksheet that contains the text you want to flash.
  7. In our example, we want to flash the contents of cell C8. But you can replace the cell reference “C8” in line 2 with a reference to the cell you want to flash.
  8. Close the VBA window.

Note: If you can’t see the Developer ribbon, from the File menu, go to Options. Select Customize Ribbon and check the Developer option from the Main Tabs. Finally, click OK.

Running the Macro

That’s it, your macro is ready to use. Now whenever you need to see your cell of choice flash, simply run the macro. Here’s how:

  1. Select the Developer tab
  2. Click on the Macros button under the Code group.
  3. This will open the Macro window, where you will find the names of all the macros that you have created so far.
  4. Select the macro (or module) named ‘FlashCell’ and click on the Run button.Select the flash cell macro
  5. You should see your designated cell flash alternately between your custom style and Normal style.Flashing cell

Note: If you want your specific cell to start flashing as soon as the workbook is opened, you can simply add the following three lines before the code:

Private Sub Workbook_Open()
Call FlashCell
End Sub

The Workbook_Open function is the first function that is run as soon as a user opens a workbook.

Finally, you can save your workbook as an Excel Macro-Enabled Workbook (*xlsm) .

Explanation of the Code

Let us take a few minutes to understand this code

  • In lines 1 and 2 we defined two global variables – NextTime and FlashRng. NextTime will later be used to hold the current time, which we want to increment a second at a time. FlashRng holds the range of cells that we want to flash. In this example, we set it to “YourSheetName!C8“. But you can set it to any cell you like. You can even set it to a whole range of cells if you like.
    Public NextTime As Double
    Public Const FlashRng As String = "YourSheetName!C8"
  • In line 3 we defined the function name.
    Sub FlashCell()
  • Lines 4 to 8 set the style for our specific cell. If it already has the style set to “FlashingText”, we change it to “Normal”, and vice-versa. This ensures that every time the FlashCell function runs, the cell alternates between “FlashingText” and “Normal”.
    If Range(FlashRng).Style = "FlashingText" Then
    Range(FlashRng).Style = "Normal"
    Range(FlashRng).Style = "FlashingText"
    End If
  • Next, in line 9, we increment NextTime by 1 second, and this keeps increasing by one second each time the FlashCell function runs. The TimeSerial  function returns a time value corresponding to the number of hours, minutes, and seconds passed to it as input. TimeSerial(0,0,1) means 1 second. The Now keyword returns the current time. So, Now+TimeSerial(0,0,1) returns the time one second from the current time.
    NextTime = Now + TimeSerial(0, 0, 1)
  • In line 10, we call the application object’s OnTime method to run the FlashCell function again at the given time (NextTime), which means one second later. In this way, FlashCell keeps calling itself and running over and over again every second.
    Application.OnTime NextTime, "FlashCell", , True
  • Line 11 simply demarcates the end of the FlashCell function
    End Sub

The above code, therefore, keeps repeating every second and the specific cell changes style from “Normal” to “FlashingText” and back to “Normal”, over and over.

Also read: How To Make All Cells The Same Size In Excel

Why Flashing Cells Isn’t a Very Good Idea

Yes, it looks attractive, yes it looks flashy. But if you ask us, we would advise you to steer clear of using macros for flashing text in your worksheets.


This is because you’re using a recursive function that keeps repeating over and over every second. This means you constantly have code running in the spreadsheet.

Your code keeps checking to see if your specific cell needs formatting and then applies a format if needed.

In this way, it is adding a significant load on your sheet and adding to the processing time. It may not seem like a big deal if you have a small dataset, but with large or complex sheets, the processing load really adds up.

Unfortunately, the whole purpose of adding flashing text is to draw attention to important cells in a large dataset.

But the processing load also kind of beats the purpose. So we would advise you to weigh out your priorities of processing efficiency vs. visual clarity.

You can then decide for yourself if you want to include flashing text or not.

Also read: Change Cell Color Based on Text Input in Excel

VBA Code to Stop the Flashing

If you do decide to include flashing text, it helps if you also have a macro to stop the flashing. This way, your reader has the option to disable it once they have seen what you want them to see.

This also saves them from getting a headache from all the blinking!

Writing the VBA Code

Here’s the code to stop the specific cell from flashing:

Sub StopFlashing()
Application.OnTime NextTime, " FlashCell", , False
Range(FlashRng).Style = "Normal"
End Sub

You can add this code to the end of the FlashCell subroutine (right after the last line – End Sub)

Stop Flashing Macro

Running the Macro

To run the above macro, follow the same steps as before:

  1. Select the Developer tab
  2. Click on the Macros button under the Code group.
  3. This will open the Macro window, where you will find the names of all the macros that you have created so far.
  4. Select the Macro (or module) named ‘StopFlashing’ and click on the Run button.Stop Flashing macro in Macro dialog box
  5. You should see the flashing in your designated cell stop and set back to the ‘Normal’ style.

Explanation of the Code

The above code is quite straightforward. The StopFlashing macro cancels the pending schedule by setting it to “False”. Make sure you use the same time variable and function name. Finally, we also set the specific cell’s style back to “Normal”.

This has been a long tutorial because the concept is a little more complex than a regular formatting tutorial.

We tried to add in everything that you would possibly need to know and understand in order to run the macro and get specific cells to flash every second.

We hope we have been successful in breaking down and simplifying the concept for you. However, as mentioned before, you are better off avoiding using flashing text in your worksheets, especially if you have large and complex datasets in them.

Other Excel Tutorials you may like:

I am a huge fan of Microsoft Excel and love sharing my knowledge through articles and tutorials. I work as a business analyst and use Microsoft Excel extensively in my daily tasks. My aim is to help you unleash the full potential of Excel and become a data-slaying wizard yourself.

6 thoughts on “How to Flash an Excel Cell?”

  1. Thank you Steve,
    Your explanations are so easy to follow and understand.
    I am also an Excel addict but a very, very beginner ☺☺

  2. Some of us are 80 & grateful for any help – so thank you.

    PS would you mind moving the note in mid tutorial, explaining about locating the “Developer Ribbon”. Being a bit stupid, I had already read half way through the tutorial before I realised the Developer Ribbon actually existed at all!!! Moving the note to the start of the tutorial might save other wrinklies from making the same mistake as me.
    PS2 Can you add a beep to sound with each flash?

  3. I get run-time error 450: Wrong number of arguments or invalid property assignment.
    I click: debug.
    It highlights: Range(FlashRng).Style=”FlashingText”

    How do i debug this? Thanks

  4. I experienced the same issue as a prior comment:
    I get run-time error 450: Wrong number of arguments or invalid property assignment.
    I click: debug.
    It highlights: Range(FlashRng).Style=”FlashingText”

    How do I debug this? Thanks


Leave a Comment