Hi,
Please could someone tell me the code to count down to the next hour (in seconds)
TIA.
PROBLEM RESOLVED.
Printable View
Hi,
Please could someone tell me the code to count down to the next hour (in seconds)
TIA.
PROBLEM RESOLVED.
This should do it.
Put a Label and a Timer on a form and then paste this code.
VB Code:
Option Explicit Dim dStartTime As Date Private Sub Form_Load() Dim iCurSecs As Integer Dim iCurMin As Integer iCurMin = Abs(60 - Format$(Now, "n")) iCurSecs = Abs(60 - Format$(Now, "s")) dStartTime = DateAdd("n", iCurMin, Now) dStartTime = DateAdd("s", iCurSecs, dStartTime) Timer1.Interval = 1000 Timer1.Enabled = True End Sub Private Sub Timer1_Timer() Label1.Caption = Format$(Now - dStartTime, "n:ss") End Sub
Greg
Many thanks :)