Macros if we meet criteria in column C2:C, blink lines

K0st4din

Well-known Member
Joined
Feb 8, 2012
Messages
501
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. 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?
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:

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Excel is 2007 or higher.
Thank you in advance.
 
Upvote 0
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[TD]P[/TD]
[TD]Q[/TD]
[TD]R[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]2(Flashing red/yellow)[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]23[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]2(Flashing red/yellow)[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]5[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]17[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]2(Flashing red/yellow)[/TD]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]2(Flashing red/yellow)[/TD]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]Flashing red/yellow[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]same[/TD]
[TD]ECT[/TD]
[/TR]
</tbody>[/TABLE]

Please tell me if there is anything unclear, try to explain it again.
 
Upvote 0
Friends, no one has any idea how to become?
Is there something that is not clear or you do not understand?
I'm asking for some comment on your part or is it impossible to get it?
Thank you again.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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