Blinking cell if value is...

M

Melissa

So this is probably something that should be very simple, but it's giving me
a headache.
I use excel at my job to keep track of stuff that needs to be picked up. The
value of this cell is manually inputted whenever it changes, Excel doesn't
calculate the value in any way. If there's 2, I input two. If it's 0, I put
in 0.
What I want it to do is blink if the value I input is greater than 0.
All the codes I've found only work if the cell value is being calculated by
Excel, or it effects more than just this particular cell.

The cell used is J1.
I want the color of the background to remain the same grey color, and if
it's 0 the text is a light grey, if it's 1 or greater the text blinks between
grey and bright red.

Can anyone help me?
 
M

Melissa

Thanks.
I'm sure it is annoying if you're staring at it constantly, but this
spreadsheet is displayed on a tv screen as a status board for workers to look
at occassionaly and know what needs to be done. Obviously something blinking
is going to grab their attention and not be overlooked.
 
O

ORLANDO VAZQUEZ

Hi Chip,

How can I rewrite the code below so that startblink does not start at the
opening of the spreadsheet but rather starts as a result of cell A1 value =
"Already Posted" ?

And also I would like to be able to stop it at will, i.e., user acknowledges
it is in "already posted" status and clicks a button to stop it...

Please help.
Thanks,
Orlando


Complete VBA 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

Then, in the ThisWorkbook code module of the workbook, use code like:

Private Sub Workbook_Open()
StartBlink
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopBlink
End Sub
 
C

Chip Pearson

Put the following code in the ThisWorkbook code module.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
If Target.Address = "$A$1" Then
StopBlink
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target.Text = "Already Posted" Then
StartBlink
End If
End If
End Sub

The blinking will start when the value changes to "Already Posted" and
will stop when the user double-clicks cell A1.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
O

ORLANDO VAZQUEZ

Thank you Chip. I know we are almost there.

But when I add that code to "thisworkbook", the lines....
Application.OnTime RunWhen......
turn red on the macors Sub StartBlink() and Sub StopBlink()
What am I missing? Thank you for sharing.

Here is how it looks at present:

Module7:

Public RunWhen As Double

Sub StartBlink()
With ThisWorkbook.Worksheets("work").Range("g6").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("work").Range("g6").Font.ColorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", ,
False
End Sub


ThisWorkbook:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Address = "$G$6" Then
StopBlink
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$G$6" Then
If Target.Text = "Already Posted" Then
StartBlink
End If
End Sub




Orlando Vazquez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top