Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Elaine
 
Posts: n/a
Default How to get time to update automatically and continuos

I would like me excel worksheet to keep the current time running continously.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Martin
 
Posts: n/a
Default How to get time to update automatically and continuos

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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"