Conditional blinking cell

asad

Well-known Member
Joined
Sep 9, 2008
Messages
1,434
I found this code from Dave in this forum and I liked it vey much. I tried to change it to suit my need but it didn't work. I will paste here the first portion of the code that I changed

Private Sub Worksheet_Change(ByVal Target As Range)
'Test the value of the specified cell
If Target.Address = "$A$3" Then
If Target.Value >= 12 Then Call Blinker(Target)
End If
End Sub

I changed it to:
Private Sub Worksheet_Calculate()
Dim R As Range
For Each R In Range("$A$1:$A$10")
If R.Value < "$B$1" Then
Call Blinker
Exit For
End If
Next R
End Sub

As I don't have any formal education in VB editing, I don't even know that this is the correct way of doing it. Can you please look at it and correct it for me?

The other part of code that goes in standard module is unchanged. But I will post it here just for your ref:


Public Sub Blinker(ByVal rng As Range)
'Causes the cell "rng" to blink 10 times
Dim myCounter As Integer
Do Until myCounter = 10
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


Thanks in advance

<!-- / message --><!-- / message -->
 
Simplify the approach. Adapt the idea at
How can I make a cell (or some other object) flash?
http://www.tmehta.com/tmxl/dbfind_byid.asp?id=14

For the conditional formatting for A1:A10 AND the MOD() with your own requirement. You should get something like
=AND(MOD condition from the above page, A1>=$B$1)
I found this code from Dave in this forum and I liked it vey much. I tried to change it to suit my need but it didn't work. I will paste here the first portion of the code that I changed



I changed it to:


As I don't have any formal education in VB editing, I don't even know that this is the correct way of doing it. Can you please look at it and correct it for me?

The other part of code that goes in standard module is unchanged. But I will post it here just for your ref:





Thanks in advance

<!-- / message --><!-- / message -->
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
many problems can be solved by just Playing with excel.
a lot of ideas were failures for the problem they were originally attempted on, but work well in another situation.

I get bit by sometimes (OK often) by thinking I know the answer to a particular question without testing all the options, but normally there are too many options to really try to check them all. in this case I still do not know what caused the error in the original ...calculate() sub. but I have fixed things in the past by just taking range info out of formulas and it worked here.
 
Upvote 0

Forum statistics

Threads
1,215,471
Messages
6,124,999
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