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
 

Some videos you may like

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

andrewkard

Active Member
Joined
Apr 6, 2012
Messages
455
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
 

ZAX

Well-known Member
Joined
Jul 5, 2012
Messages
715
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
 

Ashtechsmith

New Member
Joined
May 14, 2012
Messages
7
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
 

ZAX

Well-known Member
Joined
Jul 5, 2012
Messages
715
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
 

Watch MrExcel Video

Forum statistics

Threads
1,123,488
Messages
5,601,976
Members
414,488
Latest member
rjp847

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
Top