Digital Clock - Seconds Indicator

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,562
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am playing around with this code to see if it's going to provide what I'm looking to do.
I have my cell that the time displays in formatted as "h:mm AM/PM" (cell formatted) This appears to work, but other than actually displaying the seconds value, I'd like to have some indication of the "pulse" of the clock.
Basically, I'm looking for a way of replacing the seconds value with single character, maybe an "o", that blinks as the seconds count. It doesn't necessary have to be part of the time display format, it can be in a separate cell. Just some means to see if the clock is ticking.

Possible?

VBA Code:
Public Sub UpdateTimer()

    With wsfront
        .Cells(2, 6).Value = Format$(Now, "mm/dd/yyyy")
        .Cells(2, 2).Value = Format$(Now, "hh:mm:ss")
    End With
   
    Application.OnTime Now + TimeSerial(0, 0, 1), "UpdateTimer"

End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
.
VBA Code:
Dim TimerActive As Boolean
Sub StartTimer()
    Start_Timer
End Sub
Private Sub Start_Timer()
    TimerActive = True
    Application.OnTime Now() + TimeValue("00:00:01"), "Timer"
End Sub
Private Sub Stop_Timer()
    TimerActive = False
End Sub
Private Sub Timer()
    If TimerActive Then
        Sheet1.Cells(1, 1).Value = Time
         Sheet1.Cells(1, 2).Value = Sheet1.Cells(1, 1).Value * 60
        Application.OnTime Now() + TimeValue("00:00:01"), "Timer"
    End If
End Sub

You can edit the code to place the running clock in any cell desired.

Download example workbook : Clock Running VBA Excel.xlsm
 
Upvote 0
Thank you Logit. I appreciate your solution.
As I look at it, and play with the sample, I can't see it doing much more than what my existing code is doing. It doesn't solve the question at hand by substituting the seconds placeholders with a simple blinking character. If you think of a digital clock on a VCR (we all know what those are right ;) ), it often times has the time and in the righ hand corner a blinking dot, or the colon between the hours and minutes, blink in sync with the seconds.
 
Upvote 0
VBA Code:
Option Explicit
'Insert an ASTERISK in A1.
'Make it BOLD, FONT: CALIBRI, SIZE: 24

Sub StartBlink()
  Dim xCell As Range
  Dim xTime As Variant
 
  Set xCell = Range("A1")
 
  With ThisWorkbook.Worksheets("Sheet1").Range("A1").Font
    If xCell.Font.Color = vbRed Then
        xCell.Font.Color = vbWhite
    Else
        xCell.Font.Color = vbRed
    End If
  End With
 
  xTime = Now + TimeSerial(0, 0, 1)
  Application.OnTime xTime, "'" & ThisWorkbook.Name & "'! StartBlink", , True
 
  End Sub
 
Upvote 0
Thank you Logit, works like a charm!
 
Upvote 0

Forum statistics

Threads
1,213,535
Messages
6,114,194
Members
448,554
Latest member
Gleisner2

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