URGENT HELP ON BLINKING/FLASHING CELL

E

EXCEL USER

I am current using the blink text code found at www.cpearson.com but I would
like to make it so that if I were to change a value in a cell that it would
then start blinking. So for example: If cell A1:A100 percentages changes
between 75% to 100% than blink and if it is 100% over 100% than I need to
show some kind of different signals but I still want taht cell to be
blinking.
Also, I would like to make the cell's fill color blink from white to red and
not the text (this is not as crititcal). Any help on this would be great.
my e-mail is (e-mail address removed) Here is coding that I have used

Public RunWhen As Double

Sub StartBlink()
If Range("bq6:bq89").Font.ColorIndex = 2 Then
Range("bq6:bq89").Font.ColorIndex = xlColorIndexAutomatic
Else
Range("bq6:bq89").Font.ColorIndex = 3
End If
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink", , True
End Sub


Sub StopBlink()
Range("bq6:bq89").Font.ColorIndex = xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink", , False
End Sub

Thanks in advance!
 
C

ChadF

Might want to consider the following...

in the Worksheet_Change() event code...

Dim BlinkRange as Range

Set BlinkRange = Range("A1:A100")

If Not Intersect(Target, BlinkRange) is nothing then
if Target.Value > 75% and Target.Value < 100% then
Startblink
end if
if Target.Value > 100% then
StopBlink
end if

End If

Target is a parameter automatically supplied to the Worksheet_Change event
code. (It refers to a specific cell. What this code does - sets a named
range (A1:A100), checks to see if the Target is within that specific area,
then checks the target's value and sees if it's between 75%-100% (so you can
set the blink flag)

.... is this what you have in mind ??

Chad
 
E

EXCEL USER

Hi, Chad:

Thank you for quick reply but i am getting a compling error please hlep me
ot code properly here is the coding I did
Sub StartBlink()

Dim BlinkRange As Range

Set BlinkRange = Range("BQ6:BQ89")
If Not Intersect(Target, BlinkRange) Is Nothing Then
If Target.Value > 75 And Target.Value < 100 Then
StartBlink
Else
If Target.Value > 100 Then
StopBlink
End If

If Range("bq6:bq89").Font.ColorIndex = 3 Then
Range("bq6:bq89").Font.ColorIndex = xlColorIndexAutomatic
Else
Range("bq6:bq89").Font.ColorIndex = 3
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink", , True
End If
End Sub

please help
 
C

ChadF

Hi,

At a first glance, the compiler was barfing at you because it didnt know
what 'Target' was. The code I gave you is supposed to be in the
'Worksheet_Change' event (not as part of the definition of StartBlink).

To get to the Worksheet_Change event code, hit Alt+F11 ... then double click
on the worksheet itself ... you'll see an empty 'Worksheet_Change' definition
crop up on the code window... cut n paste what I put in there to that ...

Worksheet_Change is an automatic event fired off when you make a change to
the worksheet itself. (such as entering / changing values.) By itself, it
defaults to doing nothing. But, if you program the event, you can tell Excel
to monitor what happens if changes occur. (in your case, it looks like you
want the blinking to happen if a particular cell within your range A1:A100
are between 75% and 100% ... (also might want to deliberately set 75% and
100% to their decimal equivalents.)

Does this help get you on the right track ??

Chad
 
C

ChadF

Here's a more cleaned up version... If I read your code right, I
think this will help you iron out most of the bugs... (I modified your
StartBlink code)

Public Sub Worksheet_Change(ByVal Target As Range)
Dim BlinkRange as Range

Set BlinkRange = Range("A1:A100")

If Not Intersect(Target, BlinkRange) is nothing then
if Target.Value >= 0.75 and Target.Value <= 1.00 then
Startblink
end if
if Target.Value > 1.00 then
StopBlink
end if

End Sub

public Sub StartBlink

Dim myBlinkRange As Range
Dim RunWhen as Long

Set BlinkRange = Range("BQ6:BQ89")

With myBlinkRange
IF .Font.ColorIndex = 3 then
.Font.ColorIndex = xlColorIndexAutomatic
Else
.Font.ColorIndex = 3 ' not sure what you want to do
here...
End If
End With

RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink", , True

End Sub
 
E

EXCEL USER

Hi, Chad:

Thanks, It works

ChadF said:
Here's a more cleaned up version... If I read your code right, I
think this will help you iron out most of the bugs... (I modified your
StartBlink code)

Public Sub Worksheet_Change(ByVal Target As Range)
Dim BlinkRange as Range

Set BlinkRange = Range("A1:A100")

If Not Intersect(Target, BlinkRange) is nothing then
if Target.Value >= 0.75 and Target.Value <= 1.00 then
Startblink
end if
if Target.Value > 1.00 then
StopBlink
end if

End Sub

public Sub StartBlink

Dim myBlinkRange As Range
Dim RunWhen as Long

Set BlinkRange = Range("BQ6:BQ89")

With myBlinkRange
IF .Font.ColorIndex = 3 then
.Font.ColorIndex = xlColorIndexAutomatic
Else
.Font.ColorIndex = 3 ' not sure what you want to do
here...
End If
End With

RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink", , True

End Sub
 

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

Similar Threads

flashing cell in excel 1
Blinking cells 6
VBA code does not work 7
Run Error while protected 1
Blinking TEXT - Help needed 2
Protection in VBA. 2
Help Needed - Blinking TEXT 2
Excel Blinking TEXT 0

Top