Just wondering if anyone could help me out with a countdown timer from 60:00 mins displayed in a textbox I've tried a few different ways but its not seeming to work out for me :(
Cujo
Printable View
Just wondering if anyone could help me out with a countdown timer from 60:00 mins displayed in a textbox I've tried a few different ways but its not seeming to work out for me :(
Cujo
You mean like this? Put a command button and a text box on a form, add the code. Click button to start countdown.
Code:Option Explicit
Dim counter As Long
Private Sub Command1_Click()
Timer1.Enabled = True 'start the countdown
End Sub
Private Sub Form_Load()
counter = 3600000 'Set To 1 hour
Me.Timer1.Interval = 1000 'change display every second
End Sub
Private Sub Timer1_Timer()
Dim min As Long, seconds As Long
min = Int(counter / 60000)
seconds = Int(counter - (min * 60000)) / 1000
Me.Text1 = min & ":" & seconds
If counter = 0 Then
MsgBox "Excuse me sir, but your time is up!"
Timer1.Enabled = False
End If
counter = counter - 1000 'every second reduce counter by 1000
End Sub
Sorta but I want the timer to start running as soon as the form loads.....so i just move the timer1.enabled = true in the form load right? (hope so).....Thanx...let ya know if it works for me!
Cujo
ok its running but its printing on the form instead of the in the textbox?
Cujo
That's right. I updated the code to do it to a textbox.
Thanx works perfect now! :D:D:D:D:D:D:D:D
:cool: