Digital Clock - Seconds Indicator

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
3,923
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 did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
4,065
.
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
 

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
3,923
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
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.
 

Logit

Well-known Member
Joined
Aug 31, 2016
Messages
4,065
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
 

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
3,923
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Thank you Logit, works like a charm!
 

Watch MrExcel Video

Forum statistics

Threads
1,132,977
Messages
5,656,192
Members
418,289
Latest member
Kjohno

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
Top