This is a discussion on Flashing Cells Or Text In Excel within the Excel Questions forums, part of the Question Forums category; I want to make a cell or text within within a range flash based on whether it matches a the ...
I want to make a cell or text within within a range flash based on whether it matches a the value of another cell.
Is there a set formula or VBA code that can help me do this?
Last edited by jeffreybrown; Oct 14th, 2011 at 08:47 PM.
Excel does not have any built in feature to make text blink, and many people, including me, consider this a blessing. Most developers frown strongly at the notion of blinking text, arguing (with merit) that it is highly distracting. However, enough people have asked about it that it is worthy of discussion. Personally, I would not like a workbook with blinking text, but I don't share the passion of others in their dislike of the idea.
To make text blink,you need to execute a procedure periodically to change the font color of the text. The OnTime method can be used to run the procedure. You can use the code shown in the section below.
Complete VBA Code:
Then, in the ThisWorkbook code module of the workbook, use code like:Code:Public RunWhen As Double Sub StartBlink() With ThisWorkbook.Worksheets("Sheet1").Range("A1").Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 2 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0,0,1) Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , True End Sub Sub StopBlink() ThisWorkbook.Worksheets("Sheet1").Range("A1").Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , False End Sub
SummaryCode:Private Sub Workbook_Open() StartBlink End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) StopBlink End Sub
Two important points to keep in mind:
- Since the OnTime schedules a procedure every second, you'll encounter sluggish editing.
- Blinking text may not be allowed in applications for governmental bodies, since it may be in violation of Section 508 of the Rehabilitation Act Of 1973 (since blinking text can cause seizures in epileptic patients).
Last edited by Xtrimmer; Oct 14th, 2011 at 08:52 PM.
You right about the flashing, it's annoying beyond belief, but the boss wants it, what can you do.