PDA

View Full Version : Help with "StartBlink"



prepalot
01-25-2008, 12:04 PM
Looking for help please.
I have found a macro (see below) on this site that I would like more specific help with. The posting I refer to is the one made by Malik641 entitled "Make specific cell blink based on a condition"

Below is what I want to accomplish - and after you read the task, please feel free to tell me if you have a better I dea. I am open to anything, as I am new to VBA.

Can someone please tell me how I can independently assign the below macro to numerous disjointed cells (i.e. cells that are not in the same column or row)?
In other words, the way this macro is written, you can only assign this to a range of cells in the same row - triggered by a criteria met by a single cell. This differs from my need to assign this blinking property to, A2 when K11's value is "5" - AND - A4 when K12's value is "5" etc...
To reiterate, I also need to assign this blinking property to many paired-up cells in 1 document. Your help will be much appreciated.

Please keep in mind, this is not my macro below. I just found it in this site and have tried to tailor it. So, it may not even be the best one for my needs.

Thanks in advance!

'Place this in a Standard Module

Option Explicit
Public RunWhen As Double

Sub StartBlink()
If Range("A1").Interior.ColorIndex = 3 Then
Range("A1").Interior.ColorIndex = 6
Else
Range("A1").Interior.ColorIndex = 3
End If
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink", , True
End Sub

Sub StopBlink()
Range("A1").Interior.ColorIndex = xlAutomatic
Application.OnTime RunWhen, "StartBlink", , False
End Sub

'Then Place this code into the code module of the specific worksheet you want to work with

Option Explicit
Public CellCheck As Boolean

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

'Change the IF statement and cell range to what you need
If Range("A1") = "1" And CellCheck = False Then
Call StartBlink
CellCheck = True
ElseIf Range("A1") <> "1" And CellCheck = True Then
Call StopBlink
CellCheck = False
End If

End Sub
~~Added VBA Tags - Oorang