Label counter

asyamonique

Well-known Member
Joined
Jan 29, 2008
Messages
1,286
Office Version
  1. 2013
Platform
  1. Windows
Good Day,
Is it possible to set label like counter.
If A1 value is 200 the label will start from 0 to 200 one by one and will loop always.
Many thanks
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Couple questions:

Is the label on a userform?

What's going to make it increment it's count? A button click? Time?

And by "always", do you mean that if you close the userform(assuming that's where it is) and close the workbook, you'd like the counter to pick back up where it was before you closed it? IOW, you don't want to start back at 1 every time?

The short answer to your question is probably :) . If you answer these questions, I'm sure it can be figured out.
 
Last edited:
Upvote 0
Label will be on a userform.
The userform will be a kind of information board so I will keep it on screen all the time but if I unload it it can be remain as it is unless clicking the button!
If the cell value became let's say 2000 the label value will increase from zero up to 2000 and will began from zero again....
The numbers will start increase by clicking to command button.
 
Last edited:
Upvote 0
This seems to work.

No cell reference needed.

Code:
Private Sub CommandButton1_Click()
    If Me.Label1.Caption > 2000 Then
        Me.Label1.Caption = 0
    Else
        Me.Label1.Caption = Label1.Caption + 1
    End If
End Sub

One thing I did notice is that it will count to 2001 even though it's told to stop at 2000...not sure why that is, but it does reset on it's own.
 
Upvote 0
To stop at 2000 try
Code:
 If Me.Label1.Caption > 1999 Then
 
Upvote 0
Thanks for both reply but thats not the one I wanted exactly..
1.The number was only sample it may be any value wich is the base on cell value.
2.Numbers will not increase by click to the button...It wil start increase by one time click and will run itself untill reach the cell value and will loop from beginning.
If there is 10 it will start from 1 to 10 and will back 1 again.
Many thanks
 
Last edited:
Upvote 0
So once the button is clicked it counts up from 0 to the number in the cell? What time do you want between each number?
 
Upvote 0
may be jump to 5 digits...
If its possible running the numbers can be faster like a stop watch.

..... : ..
 
Last edited:
Upvote 0
To stop at 2000 try
Code:
 If Me.Label1.Caption > 1999 Then

LOL, yea I was out driving around and had a head slap moment. "THATS why it wouldn't stop at 2000, you dope....greater than...it has to BE greater than first, THEN reset."

That was my mistake, completely :)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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