Forum Discussion
BBowen6501
Sep 26, 2022Copper Contributor
Auto on/off blink cells
Hi! I have been banging my head on my desk for several days now trying to make any of 3 cells blink in a worksheet when a specific criteria has been me. Brief synopsis: One worksheet (WS1) au...
BBowen6501
Sep 26, 2022Copper Contributor
Is there an "Or" union option to use here so they work independently of one another?
mtarler
Sep 26, 2022Silver Contributor
I was thinking something like:
cells2blink=""
If Range("A23").Value = "PARTS" Then
cells2blink=cells2blink & "A23, "
end if
If Range("A31").Value = "PARTS" Then
cells2blink=cells2blink & "A31, "
end if
If Range("A39").Value = "PARTS" Then
cells2blink=cells2blink & "A39, "
end if
if LEN(cells2blink)>1 then
cells2blink=Left(cells2blink, LEN(cells2blink)-2)
Set CellToBlink = Range(cells2blink)
cont with blink...
cells2blink=""
If Range("A23").Value = "PARTS" Then
cells2blink=cells2blink & "A23, "
end if
If Range("A31").Value = "PARTS" Then
cells2blink=cells2blink & "A31, "
end if
If Range("A39").Value = "PARTS" Then
cells2blink=cells2blink & "A39, "
end if
if LEN(cells2blink)>1 then
cells2blink=Left(cells2blink, LEN(cells2blink)-2)
Set CellToBlink = Range(cells2blink)
cont with blink...
- BBowen6501Sep 27, 2022Copper ContributorThis is making cell A23 work, though.
Sub BlinkCell()
Dim CellToBlink As Range
If Range("A23").Value = "PARTS" Or Range("A31").Value = "PARTS" Or Range("A39").Value = "PARTS" Then
Set CellToBlink = Range("A23")
Do While Range("A23").Value = "PARTS" Or Range("A31").Value = "PARTS" Or Range("A39").Value = "PARTS"
Application.Wait (Now + TimeValue("00:00:01"))
CellToBlink.Interior.ColorIndex = 0
Application.Wait (Now + TimeValue("00:00:01"))
CellToBlink.Interior.ColorIndex = 3
Application.Wait (Now + TimeValue("00:00:01"))
DoEvents
Loop
If Range("A23").Value = "PARTS" Or Range("A31").Value = "PARTS" Or Range("A39").Value = "PARTS" Then
Set CellToBlink = Range("A31")
Do While Range("A23").Value = "PARTS" Or Range("A31").Value = "PARTS" Or Range("A39").Value = "PARTS"
Application.Wait (Now + TimeValue("00:00:01"))
CellToBlink.Interior.ColorIndex = 0
Application.Wait (Now + TimeValue("00:00:01"))
CellToBlink.Interior.ColorIndex = 3
Application.Wait (Now + TimeValue("00:00:01"))
DoEvents
Loop
If Range("A23").Value = "PARTS" Or Range("A31").Value = "PARTS" Or Range("A39").Value = "PARTS" Then
Set CellToBlink = Range("A39")
Do While Range("A23").Value = "PARTS" Or Range("A31").Value = "PARTS" Or Range("A39").Value = "PARTS"
Application.Wait (Now + TimeValue("00:00:01"))
CellToBlink.Interior.ColorIndex = 0
Application.Wait (Now + TimeValue("00:00:01"))
CellToBlink.Interior.ColorIndex = 3
Application.Wait (Now + TimeValue("00:00:01"))
DoEvents
Loop
End If
End If
End If
End Sub - BBowen6501Sep 27, 2022Copper ContributorStill no luck.
- HansVogelaarSep 27, 2022MVP
If you really really want this, see the attached sample workbook. There is code in ThisWorkbook and in Module1. Both are required.
- BBowen6501Sep 27, 2022Copper Contributor
Bold item near bottom is tripping "Variable not defined" compile error. Please advise. Thanks!
Sub ManageBlink()
Dim rng As Range
For Each rng In Worksheets("CI").Range("A23,A31,A39")
With rng
If .Value = "PARTS" Then
If .Interior.ColorIndex = 3 Then
.Interior.ColorIndex = 0
Else
.Interior.ColorIndex = 0
End If
End If
End With
Next rng
dtmNext = DateAdd("s", 1, Now)
Application.OnTime dtmNext, "ManageBlink"
End Sub