Flashing cells

S

sonicscooter

Hi, i wanted to have several cells were if the value reaches a certain amout
a third cell will slowly flash, the code below works to some extent but not
properly, cell A1 flashes blue when H1 is higher in value than G1, but i
wanted cell B1 to flash if I1 was greater than J1 and so on, but it doesn't
work correctly, the top half of the code takes presidence over the later half.

Any ideas were i have gone wrong?

Mnay thanks for any help.

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("H1") > ("G1") Then
Beep
Dim newColor As Integer
Dim myCell As Range
Dim x As Integer
Dim fSpeed
Set myCell = Range("A1")
newColor = 41
fSpeed = 0.5
Do Until x = 10
DoEvents
Start = Timer
Delay = Start + fSpeed
Do Until Timer > Delay
DoEvents
myCell.Interior.ColorIndex = newColor
Loop
Start = Timer
Delay = Start + fSpeed
Do Until Timer > Delay
DoEvents
myCell.Interior.ColorIndex = xlNone
Loop
x = x + 1
Loop
Else
If Range("I1") > Range("J1") Then
Beep
Set myCell = Range("B1")
newColor = 24
fSpeed = 0.5
Do Until x = 10
DoEvents
Start = Timer
Delay = Start + fSpeed
Do Until Timer > Delay
DoEvents
myCell.Interior.ColorIndex = newColor
Loop
Start = Timer
Delay = Start + fSpeed
Do Until Timer > Delay
DoEvents
myCell.Interior.ColorIndex = xlNone
Loop
x = x + 1
Loop
Else
Application.StatusBar = False
Application.DisplayStatusBar = Application.DisplayStatusBar
Application.EnableEvents = True
End If
End If
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

Help with VBA 3
Flashing TextBox 1
Flashing UserForm Label 1
Creative graphics 2
Application wait question 4
Timed and blinking messages 4
Errors Closing Userform 0
to many e-mails 2

Top