PDA

View Full Version : cell blinking



atuljadhavne
05-23-2012, 09:39 PM
Dear expert

I have report where the figure shd not be in (-), so when the cell having less than 0 value than then that cell blinking continuously
don't want to use conditional formatting b'cos it change the cell color once but not blink

is this possible

using excel 2007

Bob Phillips
05-24-2012, 12:16 AM
Blinking is an awful thing to inflict upon a user. If I got a spreadsheet that did that I would refuse to use it. In some places it might even be against laws designed to protect people with disabilities.

Don't do it!

atuljadhavne
05-24-2012, 12:28 AM
ok
tnx for updates...

Kenneth Hobs
05-24-2012, 10:58 AM
I totally agree with xld. Howsoever, I also believe in letting the user decide to go against advice.

To make the interior color blink for A1 if it is 1, then in a Module:
Option Explicit
Public RunWhen As Double

Sub StartBlink(cell As String)
If Range(cell).Interior.ColorIndex = 3 Then
Range(cell).Interior.ColorIndex = 6
Else
Range(cell).Interior.ColorIndex = 3
End If
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "'StartBlink """ & cell & """'", , True
End Sub

Sub StopBlink(cell As String)
Range(cell).Interior.ColorIndex = xlColorIndexNone
Application.OnTime RunWhen, "'StartBlink """ & cell & """'", , False
End Sub

Right click the sheet, View Code, and paste:
Option Explicit
Public CellCheck As Boolean

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address(False, False) <> "A1" Then Exit Sub
If Range("A1") = "1" And CellCheck = False Then
StartBlink "A1"
CellCheck = True
ElseIf Range("A1") <> "1" And CellCheck = True Then
StopBlink "A1"
CellCheck = False
End If
End Sub