flashing of cell

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,057
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
Is there a better way to get this code a bit shorter. As it works perfect, but need to modify in a much easier way.
any help...

VBA Code:
If Sheets("Report").Range("I7").Value = "Raw Data Miss Match" Then
    Range("H6").Interior.Color = vbCyan
    Range("J6:M6").Interior.Color = vbCyan
    Application.Wait (Now + TimeValue("0:00:01"))
    Range("H6").Interior.Color = vbWhite
    Range("J6:M6").Interior.Color = vbWhite
    Application.Wait (Now + TimeValue("0:00:01"))
    Range("H6").Interior.Color = vbCyan
    Range("J6:M6").Interior.Color = vbCyan
    Application.Wait (Now + TimeValue("0:00:01"))
    Range("H6").Interior.Color = vbWhite
    Range("J6:M6").Interior.Color = vbWhite
    Application.Wait (Now + TimeValue("0:00:01"))
    Range("H6").Interior.Color = vbCyan
    Range("J6:M6").Interior.Color = vbCyan
    Application.Wait (Now + TimeValue("0:00:01"))
    Range("H6").Interior.Color = vbWhite
    Range("J6:M6").Interior.Color = vbWhite
    Application.Wait (Now + TimeValue("0:00:01"))
    Range("H6").Interior.Color = vbCyan
    Range("J6:M6").Interior.Color = vbCyan
    Range("I7:M7").Interior.Color = vbCyan
    MsgBox "In Correct Handle Calls in Raw Data" & vbNewLine & "Ref sheet RawData Check", vbCritical, "Raw Data Miss Match"
    Sheets("RawData Check").Select
Else
    Range("H6").Interior.Color = vbWhite
    Range("J6:M6").Interior.Color = vbWhite
    Range("I7:M7").Interior.Color = vbWhite
End If
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
VBA Code:
If Sheets("Report").Range("I7").Value = "Raw Data Miss Match" Then
'
    For Counter = 2 To 7
        If Counter Mod 2 = 0 Then
            Range("H6,J6:M6").Interior.Color = vbCyan
            Application.Wait (Now + TimeValue("0:00:01"))
        Else
            Range("H6,J6:M6").Interior.Color = vbWhite
            Application.Wait (Now + TimeValue("0:00:01"))
        End If
    Next
'
    Range("H6,J6:M6,I7:M7").Interior.Color = vbCyan
'
    MsgBox "In Correct Handle Calls in Raw Data" & vbNewLine & "Ref sheet RawData Check", vbCritical, "Raw Data Miss Match"
    Sheets("RawData Check").Select
Else
    Range("H6,J6:M6,I7:M7").Interior.Color = vbWhite
End If
 
Upvote 0
A minor tweak to johnnyL's code:

VBA Code:
If Sheets("Report").Range("I7").Value = "Raw Data Miss Match" Then
'
    For Counter = 2 To 7
        Range("H6,J6:M6").Interior.Color = Array(vbCyan, vbWhite)(Counter Mod 2)
        Application.Wait (Now + TimeValue("0:00:01")
    Next
'
    Range("H6,J6:M6,I7:M7").Interior.Color = vbCyan
'
    MsgBox "In Correct Handle Calls in Raw Data" & vbNewLine & "Ref sheet RawData Check", vbCritical, "Raw Data Miss Match"
    Sheets("RawData Check").Select
Else
    Range("H6,J6:M6,I7:M7").Interior.Color = vbWhite
End If
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

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