Upon Opening The Workbook Cell To Blink

VinceF

Board Regular
Joined
Sep 22, 2007
Messages
206
Office Version
  1. 2016
Platform
  1. Windows
Greeting,

Is there a way to modify the below code so that when the workbook is opened cell O2 will automatically start blinking without having to select the cell.
The top code is in "Main" sheet and the bottom code is in a Module?

Thanks
VinceF
Win10
Office2019

VBA Code:
Option Explicit
Public CellCheck As Boolean
 
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
     
     If Range("O2") = "Select Game" And CellCheck = False Then
        Call StartBlink
        ElseIf Range("O2") <> "Select Game" And CellCheck = True Then
        Call StopBlink
        CellCheck = False
    End If
End Sub

VBA Code:
Option Explicit
Public RunWhen As Double
 
Sub StartBlink()
    If Range("O2").Interior.ColorIndex = 49 Then
        Range("O2").Interior.ColorIndex = 6
    Else
        Range("O2").Interior.ColorIndex = 49
    End If
    RunWhen = Now + TimeSerial(0, 0, 1)
    Application.OnTime RunWhen, "StartBlink", , True
End Sub
 
Sub StopBlink()
    Range("O2").Interior.ColorIndex = xlAutomatic
    Application.OnTime RunWhen, "StartBlink", , False
End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
One way might be to add a pause function like the one below. I don't know how you want to start/stop the blinking or if you want it to blink x number of times, or something else so I can't suggest how you'd call it. An example of a counter would be
VBA Code:
For i = 1 to 5
    'set the colour based on some logic
    Pause(1)' pause for one second
    'change the colour based on some logic
    Pause(1)
Next
VBA Code:
Sub pause(sngSecs As Single)
Dim endTime As Single

'example of Timer value at run time: 43828.66. Thus endTime = 43828.66
endTime = Timer

'Timer is built in function that gets number of seconds after midnight so
'if sngSecs = 5 then do until timer is greater than 43828.66 + 5
Do Until Timer > endTime + sngSecs
'Debug.Print Timer
Loop

End Sub
 
Upvote 0
Micron...Thanks for the reply....!

What I have is cell (O2) that I want to automatically blink when the workbook is opened. This cell (O2) contains a drop down list and would continue to blink until a selection is made from the DDL. Once a selection from the DDL is made the cell would no longer blink. Ultimately I will have 10 cells all containing a DDL that I would want to blink in a sequential order to complete the process of setting up the game parameters. Cell O3 would be the next cell to blink then in sequential order the process would be repeated an additional 8 times.
I hope this helps and I appreciate your assistance.

VinceF
Win10
Office 2019
 
Upvote 0
Micron...Thanks for the reply....!

What I have is cell (O2) that I want to automatically blink when the workbook is opened. This cell (O2) contains a drop down list and would continue to blink until a selection is made from the DDL. Once a selection from the DDL is made the cell would no longer blink. Ultimately I will have 10 cells all containing a DDL that I would want to blink in a sequential order to complete the process of setting up the game parameters. Cell O3 would be the next cell to blink then in sequential order the process would be repeated an additional 8 times.
I hope this helps and I appreciate your assistance.

VinceF
Win10
Office 2019
On a side note my current code is causing my cursor to blink...SUPER ANNOYING...help :-)
 
Upvote 0
If it was my project I'd just highlight the cells and avoid having the screen re-draw at the rate of something like once per second.
 
Upvote 0
If it was my project I'd just highlight the cells and avoid having the screen re-draw at the rate of something like once per second.
Thank you for your time/advice.
 
Upvote 0
You're welcome. BTW, I assumed that the blinking cursor had to do with the screen updating, and if you want to see blinking, you can't disable screen updating so I'd say you'd be stuck with that. That's why I suggested make one or all dd's yellow or whatever, until a list item is chosen. Good luck!
 
Upvote 0

Forum statistics

Threads
1,225,730
Messages
6,186,701
Members
453,369
Latest member
positivemind

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