K0st4din
Well-known Member
- Joined
- Feb 8, 2012
- Messages
- 501
- Office Version
- 2016
- 2013
- 2011
- 2010
- 2007
- Platform
- Windows
Hello, everyone,
I have a macro in which if in C2 = 2, the lines of A2: R2 begin to blink.
Please ask for help on your part - how to change it to check every cell in the range C2:C and if some C2,3,4,5 ..... and so the end of the same row to blink these lines .
Example: If C2=2, blink lines A2:R2, if C4=2, blink lines A4:R4, if C35=2, blink lines A35:R35 and so to the end.
I also have my macro that only works for one line.
And how do I do that by opening the workbook, if there are such criteria, automatically blinking?
Thank you in advance.
Greetings
I have a macro in which if in C2 = 2, the lines of A2: R2 begin to blink.
Please ask for help on your part - how to change it to check every cell in the range C2:C and if some C2,3,4,5 ..... and so the end of the same row to blink these lines .
Example: If C2=2, blink lines A2:R2, if C4=2, blink lines A4:R4, if C35=2, blink lines A35:R35 and so to the end.
I also have my macro that only works for one line.
And how do I do that by opening the workbook, if there are such criteria, automatically blinking?
Code:
code in sheet
Option Explicit
Public CellCheck As Boolean
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Range("c2") = "2" And CellCheck = False Then
Call StartBlink
CellCheck = True
ElseIf Range("c2") <> "2" And CellCheck = True Then
Call StopBlink
CellCheck = False
End If
End Sub
Code:
code in module1
Option Explicit
Public RunWhen As Double
Sub StartBlink()
If Range("A2:r2").Interior.ColorIndex = 3 Then
Range("A2:r2").Interior.ColorIndex = 6
Else
Range("A2:r2").Interior.ColorIndex = 3
End If
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink", , True
End Sub
Sub StopBlink()
Range("A2:r2").Interior.ColorIndex = xlAutomatic
Application.OnTime RunWhen, "StartBlink", , False
End Sub
Thank you in advance.
Greetings
Last edited: