Flushing cell & contents

amabdullah

Board Regular
Joined
Mar 13, 2010
Messages
55
Dear all, can some one help me for the following:
I am trying to get continue flushing contents and cell B1, once value of cell A1 <=0. Flushing must stop after value of cell A1 is >0. I got the following code but even cell A1 value >0 the cell still flushing.


Public Sub Blinker(ByVal rng As Range)
'Causes the cell "rng" to blink 10 times
Dim myCounter As Integer
Do Until myCounter = 100
With rng.Interior
If .ColorIndex = 6 Then
.ColorIndex = xlNone
Else
.ColorIndex = 6
End If
Pause (0.2)
myCounter = myCounter + 1
End With
Loop
End Sub
Public Sub Pause(ByVal dblSecs As Double)
'Pauses the execution of code for the specified number of seconds
Dim Start
Start = Timer
Do While Timer < Start + dblSecs
DoEvents
Loop
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
'Test the value of the specified cell
If Target.Address = "$A$1" Then
If Target.Value < 0 Then Call Blinker(Target)
End If
End Sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
This seems to work when I test it, although it flashes 100 times, not 10 as your comment would indicate.

Maybe you could add to your IF statement in the Worksheet_Change procedure so it also checks for Target.Value >= 0 and formats the cell the way you want or "turns off" the flashing?
 
Upvote 0

Forum statistics

Threads
1,215,467
Messages
6,124,984
Members
449,201
Latest member
Lunzwe73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top