Help with installing VBA code in Excel please (already have the code)
11/20/10 09:20 PM, ID: 26629410
This is a new question but relates to the above thread (which may or may not be needed). It refers to Excel (2007) VBA code that creates a time-of-day display in cell A1 which updates every minute automatically (it's essentially a clock).
Part of the code is in the Workbook folder:
Private Sub Workbook_Open()
and part is in a module:
Public Sub DoTick()
Application.Range("A1").Value = Now()
Application.OnTime Now() + TimeValue("00:01"), "DoTick"
The clock works well as long as the workbook in which it is located is the active window. If another application or even a different instance of Excel is activated, the clock stops updating. I suppose that would be OK if when it is reactivated, it would immediately update. However, it does not. Moreover, even pressing the re-calculate button does not do it. The only way I can find to get it updated is to click on cell A1 and press Enter.
1) Is there any way to modify the code so it will keep running (updating) even when behind other windows (i.e. when it is inactive)?
2) If not, is there a way get it to update immediately whenever that workbook is re-activated?