Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004

    Unanswered: Countdown timer help....

    hi guys! i want to create a 'simple' countdown timer (from 30 - 0 secs.) in excel. any code to share? (this is an easy job in vb using timer control but i cant find it in excel vb...)

    objects in userform:
    - Label1 (in which the countdown is shown)
    - CommandButton (if pressed, starts the countdown)

    thnx in advance...

  2. #2
    Join Date
    Jan 2004
    Aberdeen, Scotland
    Ok 2 things needed here

    firstly in your Class module where your Controls reside
    Private Sub cmdStart_Click()
        lblTime.Caption = 30
    End Sub
    and in a module

    Public Sub StartTimer()
        Application.OnTime DateAdd("s", 1, Now), "RunTimer"
    End Sub
    Public Sub RunTimer()
        Worksheets("sheet1").lblTime.Caption = CInt(Worksheets("sheet1").lblTime.Caption) - 1
        If Worksheets("sheet1").lblTime.Caption > 0 Then StartTimer
    End Sub
    this should do what you need from it

Posting Permissions

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