How To Make a Timer?

ZAX

Well-known Member
Joined
Jul 5, 2012
Messages
715
Hi all,

I hope you can help me making a timer i.e
a cell which has a value that increases every second .

I'm so excited to get the answer

ZAX
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hello, try:
Code:
Sub test()
    Dim i&
    Cells(1, 1).Value = 10
    For i = 1 To 10
        Application.Wait Now + TimeValue("00:00:01")
        Cells(1, 1).Value = Cells(1, 1).Value + 10
    Next i
End Sub
 
Upvote 0
Hi,

Thanks for the code but at first your timer works great but while running the timer the mouse cursor turns into an hourglass and you can't do any thing I need to use Excel while the timer runs .

second the timer works for a few minutes and then stops ,can you make me a macro that I can assign to a button on the worksheet to stop the timer ?

Thanks a lot for your code .

ZAX
 
Upvote 0
1. From menu View>ToolBars>Select Control Toolbox
2. From the control toolbar click 'Command Button'
3. Point to a cell in worksheet and draw the button.
4. Right click the button>Properties and in Properties window enter Caption
as 'Start'
5. Double click the command button and paste the below code within the click
event.

Private Sub CommandButton1_Click()
lngCol = IIf(CommandButton1.Caption = "Stop", 2, 1)
lngRow = ActiveSheet.Cells(Rows.Count, lngCol).End(xlUp).Row + 1
Cells(lngRow, lngCol) = Now()
CommandButton1.Caption = IIf(CommandButton1.Caption = "Stop", "Start", "Stop")
End Sub

6. From workbook toolbar 'control toolbox' click on 'Exit Design mode'
8. Button click and try. This should record the start time and end time in
Col A
and B respectively
 
Upvote 0
Hi Ashtechsmith,

Thank you very much for your code ,your macro works perfectly and I found it
so useful but thats not what I ment by "Timer" ,I ment kind of a meter that starts with "0" and increases like(1,2,3,4,....etc) .

Thanks for the code it's fantastic .

ZAX
 
Upvote 0

Forum statistics

Threads
1,214,592
Messages
6,120,433
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top