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

K0st4din

Active Member
Joined
Feb 8, 2012
Messages
488
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

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Excel is 2007 or higher.
Thank you in advance.
 
Upvote 0
ABCDEFGHIKLMNOPQR1
Flashing red/yellowFlashing red/yellow2(Flashing red/yellow)samesamesamesamesamesamesamesamesamesamesamesamesamesame2
233
Flashing red/yellowFlashing red/yellow2(Flashing red/yellow)samesamesamesamesamesamesamesamesamesamesamesamesamesame4
55
176
Flashing red/yellowFlashing red/yellow2(Flashing red/yellow)Flashing red/yellowFlashing red/yellowFlashing red/yellowFlashing red/yellowFlashing red/yellowFlashing red/yellowFlashing red/yellowFlashing red/yellowsamesamesamesamesamesame7
18
39
Flashing red/yellowFlashing red/yellow2(Flashing red/yellow)Flashing red/yellowFlashing red/yellowFlashing red/yellowFlashing red/yellowFlashing red/yellowsamesamesamesamesamesamesamesamesameECT

<tbody>
</tbody>

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,216,212
Messages
6,129,547
Members
449,515
Latest member
lukaderanged

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