auto number generation

abdul43

Board Regular
Joined
Aug 19, 2011
Messages
58
HI,
Is there any code by which i can get numbers in a specific cell increasing after every 2-3 seconds??? for example

when i press start button inserted by control tool box
in cell A1
numbers start changing from
1
2
3
4
5
6
till the last given limit.
Help me if possible, please.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
This should do what you want and will stop when the number gets to 10

Code:
Sub Count()
     With ActiveSheet.Range("A1")
        .Value = .Value + 1
        If .Value >= 10 Then Exit Sub 'limit
    End With
    Application.OnTime Now + TimeValue("00:00:02"), "Count" 'every 2 seconds
End Sub
 
Upvote 0
Although this is working but with an error, that is when i click button the messege comes after 1 saying:

Cannot run the macro book 1 count'. macros may not be available or may be disabled .......

but i have already enabled the macro.
Nice work by u but it needs a bit more, can u? please
 
Upvote 0
Have you assigned it to a shape correctly?

All you do is create a module in the workbook, add the code.

Add shape to your worksheet, right click it and assign macro. Then chose "Count" from the list.

I have tested and it works...?
 
Upvote 0

Forum statistics

Threads
1,214,419
Messages
6,119,389
Members
448,891
Latest member
tpierce

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