I would like me excel worksheet to keep the current time running continously.
I would like me excel worksheet to keep the current time running continously.
The problem with "continuous" is that it will mean a macro continuously
running so you wouldn't be able to do anything else in your worksheet (unlike
computer games, only one process can happen at a time in Excel).
Another solution would be to use a suitable "event" to trigger a macro to
update the time. I would suggest the SelectionChange event, i.e. the time
updates every time you move the worksheet cursor. It's tempting to just make
the macro recalculate at this point but you could have loads of other
formulas in the sheet which would then also recalculate, slowing things up
considerably.
I think the best solution (but would be interested to read others) is to
simply replace the cell contents with the latest time. Paste the following
into the class module of the sheet you're working in (double-click on the
sheet name in the Project Explorer in VB Editor). I've put the time into A1
but you could change Cells(1,1) if you wanted a different cell. To make it
run as quickly as possible, I haven't included formatting in the macro so
you'll need to give cell A1 the time format you want:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells(1, 1) = Time
End Sub
"Elaine" wrote:
> I would like me excel worksheet to keep the current time running continously.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks