Make a cell flash twice

j844929

Active Member
Joined
Aug 18, 2002
Messages
423
Hi,

Can anyone help with the following:

I have code that goes to a specified sheet, and selects the row containing today's date in column A. The cell directly to the left is then selected.

How do I make this cell flash red twice, to indicate where the cursor is?



Any help would be much appreciated.

Thanks.
T
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Code:
Sub test()
    i = ActiveCell.Interior.ColorIndex
    ActiveCell.Interior.ColorIndex = 6
    Application.Wait Now + TimeValue("00:00:01")
    ActiveCell.Interior.ColorIndex = i
    Application.Wait Now + TimeValue("00:00:01")
    ActiveCell.Interior.ColorIndex = 6
    Application.Wait Now + TimeValue("00:00:01")
    ActiveCell.Interior.ColorIndex = i
End Sub
 
Upvote 0
Not sure how you'd do that exactly, but you can turn it red for a second:
Code:
Option Explicit

Private strCell As String
Private mlngColour As Long
Private mlngColourIndex As Long

Sub FlashCell()
    Dim i As Integer
    
    strCell = ActiveCell.Address
    
    TurnCellRed
    Application.OnTime Now + 1 / (24# * 60 * 60), "ResetCellColour"
End Sub

Sub TurnCellRed()
    With Range(strCell).Interior
        mlngColour = .Color
        mlngColourIndex = .ColorIndex
        .Color = RGB(255, 0, 0)
    End With
End Sub


Sub ResetCellColour()
    With Range(strCell).Interior
        If mlngColourIndex = xlNone Then
            .ColorIndex = xlNone
        Else
            .Color = mlngColour
        End If
    End With
End Sub
Clearly you can repeat the flashing, but OnTime can only deal in whole numbers of seconds, so flashing twice will take at least 3 seconds: 1 on, 1 off, 1 on.
 
Upvote 0

Forum statistics

Threads
1,226,498
Messages
6,191,376
Members
453,655
Latest member
lasvegasbuffet

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