Results 1 to 2 of 2

Thread: Adding the time (updated constantly) into an Excel Spreadsheet?

  1. #1
    Guest
    Hi all,

    Is there a way of inputting a clock via VB code into my Excel Spreadhseet. I would like it to be constantly updated.

    Thanks

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008

    VBA in Excel

    Easiest way is to use the Timer statement in Excel to get a time and then update some Cell to indicate the time. You could use VB with a timer control to call that user defined function at regular intervals using Excel as an OLE object.

    e.g. Dim xlApp as Excel Application etc...

    This sub-routine will return the time in Excel VBA

    Code:
    Public Sub DisplayClock()
    
    Dim t As Single, u As Date
    
    t = Timer
    u = CDate(t / 86400)
    MsgBox u
    
    End Sub
    Cheers,

    Paul.

    P.S. Does anyone know how to poll automatically in Excel alone?
    Not nearly so tired now...

    Haven't been around much so be gentle...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width