Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 16
Default NUMBERS RUN IN ONE CELL

Is there anyway by which i can make one cell to continously show numbers
running from 0 to 100,000 and then again start from 0.

I have sheet where I refresh the external data and by the time data is
refreshed I want one of the cells to show the pattern of running numbers.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default NUMBERS RUN IN ONE CELL

Sub CountDown()
Static cnt As Long

Range("A1").Value = cnt
cnt = cnt + 1
If cnt 100000 Then

cnt = 0
End If

Application.OnTime Now + TimeSerial(0, 0, 1), "CountDown"

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"SANDIND" wrote in message
...
Is there anyway by which i can make one cell to continously show numbers
running from 0 to 100,000 and then again start from 0.

I have sheet where I refresh the external data and by the time data is
refreshed I want one of the cells to show the pattern of running numbers.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default NUMBERS RUN IN ONE CELL

Just as a point of interest, these four lines from your code....

cnt = cnt + 1
If cnt 100000 Then
cnt = 0
End If

can be replaced by this single line...

cnt = (cnt + 1) Mod 100001

Although I would note your code is marginally quicker than what I posted.

Rick


"Bob Phillips" wrote in message
...
Sub CountDown()
Static cnt As Long

Range("A1").Value = cnt
cnt = cnt + 1
If cnt 100000 Then

cnt = 0
End If

Application.OnTime Now + TimeSerial(0, 0, 1), "CountDown"

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"SANDIND" wrote in message
...
Is there anyway by which i can make one cell to continously show numbers
running from 0 to 100,000 and then again start from 0.

I have sheet where I refresh the external data and by the time data is
refreshed I want one of the cells to show the pattern of running numbers.




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default NUMBERS RUN IN ONE CELL

But why?

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Rick Rothstein (MVP - VB)" wrote in
message ...
Just as a point of interest, these four lines from your code....

cnt = cnt + 1
If cnt 100000 Then
cnt = 0
End If

can be replaced by this single line...

cnt = (cnt + 1) Mod 100001

Although I would note your code is marginally quicker than what I posted.

Rick


"Bob Phillips" wrote in message
...
Sub CountDown()
Static cnt As Long

Range("A1").Value = cnt
cnt = cnt + 1
If cnt 100000 Then

cnt = 0
End If

Application.OnTime Now + TimeSerial(0, 0, 1), "CountDown"

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"SANDIND" wrote in message
...
Is there anyway by which i can make one cell to continously show numbers
running from 0 to 100,000 and then again start from 0.

I have sheet where I refresh the external data and by the time data is
refreshed I want one of the cells to show the pattern of running
numbers.






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 16
Default NUMBERS RUN IN ONE CELL

thanks for your help Bob..

I am new to VB.. plz help me , what i have done is right click the sheet and
pasted yoyr given code in the sheet . Once i run the code it is changing 0 to
1 and +1 onwards each time i run the code but in addition message is coming
this macro could not be found.

And one more thing whether it is possible or not , is there any way that i
get by running macro only once numbers from 0 -100000.

Thanks for your help in advance...

"Bob Phillips" wrote:

Sub CountDown()
Static cnt As Long

Range("A1").Value = cnt
cnt = cnt + 1
If cnt 100000 Then

cnt = 0
End If

Application.OnTime Now + TimeSerial(0, 0, 1), "CountDown"

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"SANDIND" wrote in message
...
Is there anyway by which i can make one cell to continously show numbers
running from 0 to 100,000 and then again start from 0.

I have sheet where I refresh the external data and by the time data is
refreshed I want one of the cells to show the pattern of running numbers.






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 16
Default NUMBERS RUN IN ONE CELL

thanks for your help Rick..

I am new to VB.. plz help me , what i have done is right click the sheet and
pasted yoyr given code in the sheet . Once i run the code it is changing 0 to
1 and +1 onwards each time i run the code but in addition message is coming
this macro could not be found.

And one more thing whether it is possible or not , is there any way that i
get by running macro only once numbers from 0 -100000.

Thanks for your help in advance...

"Rick Rothstein (MVP - VB)" wrote:

Just as a point of interest, these four lines from your code....

cnt = cnt + 1
If cnt 100000 Then
cnt = 0
End If

can be replaced by this single line...

cnt = (cnt + 1) Mod 100001

Although I would note your code is marginally quicker than what I posted.

Rick


"Bob Phillips" wrote in message
...
Sub CountDown()
Static cnt As Long

Range("A1").Value = cnt
cnt = cnt + 1
If cnt 100000 Then

cnt = 0
End If

Application.OnTime Now + TimeSerial(0, 0, 1), "CountDown"

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"SANDIND" wrote in message
...
Is there anyway by which i can make one cell to continously show numbers
running from 0 to 100,000 and then again start from 0.

I have sheet where I refresh the external data and by the time data is
refreshed I want one of the cells to show the pattern of running numbers.





  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default NUMBERS RUN IN ONE CELL

But why what?...

Why did I post my formula? I thought readers of this thread (whether in this
newsgroup or in the Google archives) would be interested in seeing the
equivalence between the longer (direct) method that you posted and the
shorter (Mod function call) method that I posted.

Why is your code marginally quicker? It takes longer to execute a Mod
function than an If-Then test.

Some other why?

Rick


"Bob Phillips" wrote in message
...
But why?

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Rick Rothstein (MVP - VB)" wrote in
message ...
Just as a point of interest, these four lines from your code....

cnt = cnt + 1
If cnt 100000 Then
cnt = 0
End If

can be replaced by this single line...

cnt = (cnt + 1) Mod 100001

Although I would note your code is marginally quicker than what I posted.

Rick


"Bob Phillips" wrote in message
...
Sub CountDown()
Static cnt As Long

Range("A1").Value = cnt
cnt = cnt + 1
If cnt 100000 Then

cnt = 0
End If

Application.OnTime Now + TimeSerial(0, 0, 1), "CountDown"

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"SANDIND" wrote in message
...
Is there anyway by which i can make one cell to continously show
numbers
running from 0 to 100,000 and then again start from 0.

I have sheet where I refresh the external data and by the time data is
refreshed I want one of the cells to show the pattern of running
numbers.






  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default NUMBERS RUN IN ONE CELL

Why would you replace code that is very clear, very obvious in its intent,
with code that is not, and offers no perceptible benefits.

In other words, why use 'clever' code just for its own sake.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Rick Rothstein (MVP - VB)" wrote in
message ...
But why what?...

Why did I post my formula? I thought readers of this thread (whether in
this newsgroup or in the Google archives) would be interested in seeing
the equivalence between the longer (direct) method that you posted and the
shorter (Mod function call) method that I posted.

Why is your code marginally quicker? It takes longer to execute a Mod
function than an If-Then test.

Some other why?

Rick


"Bob Phillips" wrote in message
...
But why?

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Rick Rothstein (MVP - VB)" wrote
in message ...
Just as a point of interest, these four lines from your code....

cnt = cnt + 1
If cnt 100000 Then
cnt = 0
End If

can be replaced by this single line...

cnt = (cnt + 1) Mod 100001

Although I would note your code is marginally quicker than what I
posted.

Rick


"Bob Phillips" wrote in message
...
Sub CountDown()
Static cnt As Long

Range("A1").Value = cnt
cnt = cnt + 1
If cnt 100000 Then

cnt = 0
End If

Application.OnTime Now + TimeSerial(0, 0, 1), "CountDown"

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"SANDIND" wrote in message
...
Is there anyway by which i can make one cell to continously show
numbers
running from 0 to 100,000 and then again start from 0.

I have sheet where I refresh the external data and by the time data is
refreshed I want one of the cells to show the pattern of running
numbers.








  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default NUMBERS RUN IN ONE CELL

It should be in a standard code module, not in the sheet module.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"SANDIND" wrote in message
...
thanks for your help Bob..

I am new to VB.. plz help me , what i have done is right click the sheet
and
pasted yoyr given code in the sheet . Once i run the code it is changing 0
to
1 and +1 onwards each time i run the code but in addition message is
coming
this macro could not be found.

And one more thing whether it is possible or not , is there any way that i
get by running macro only once numbers from 0 -100000.

Thanks for your help in advance...

"Bob Phillips" wrote:

Sub CountDown()
Static cnt As Long

Range("A1").Value = cnt
cnt = cnt + 1
If cnt 100000 Then

cnt = 0
End If

Application.OnTime Now + TimeSerial(0, 0, 1), "CountDown"

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"SANDIND" wrote in message
...
Is there anyway by which i can make one cell to continously show
numbers
running from 0 to 100,000 and then again start from 0.

I have sheet where I refresh the external data and by the time data is
refreshed I want one of the cells to show the pattern of running
numbers.






  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 16
Default NUMBERS RUN IN ONE CELL

Thanks Bob...

Your advice has been really very helpful...

"Bob Phillips" wrote:

It should be in a standard code module, not in the sheet module.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"SANDIND" wrote in message
...
thanks for your help Bob..

I am new to VB.. plz help me , what i have done is right click the sheet
and
pasted yoyr given code in the sheet . Once i run the code it is changing 0
to
1 and +1 onwards each time i run the code but in addition message is
coming
this macro could not be found.

And one more thing whether it is possible or not , is there any way that i
get by running macro only once numbers from 0 -100000.

Thanks for your help in advance...

"Bob Phillips" wrote:

Sub CountDown()
Static cnt As Long

Range("A1").Value = cnt
cnt = cnt + 1
If cnt 100000 Then

cnt = 0
End If

Application.OnTime Now + TimeSerial(0, 0, 1), "CountDown"

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"SANDIND" wrote in message
...
Is there anyway by which i can make one cell to continously show
numbers
running from 0 to 100,000 and then again start from 0.

I have sheet where I refresh the external data and by the time data is
refreshed I want one of the cells to show the pattern of running
numbers.








  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default NUMBERS RUN IN ONE CELL

Personally, I don't consider this statement...

cnt = (cnt + 1) Mod 100001

to be unclear, unobvious nor 'clever' in the sense I think you mean it. I
find the above line to be every bit as understandable as the multi-line code
you posted; but, of course, that is probably because I am intimately
familiar with the Mod operator and how it works. The Mod operator (like its
worksheet formula counterpart) can be a powerful programming tool when used
with cyclical counting type processes (such as in this thread's subject
matter or with calendar and time calculations) and I think it is one
programmers should be introduced to if they are unfamiliar with it. My hope
is that by my posting the equivalency of the above statement to your posted
code, it might spark some programmers out there who experience a "Wow!"
moment over it to take the time to learn more about this operator; those for
who do not experience such a moment, well, nothing is really lost as they
will simply read over it and move on.

Rick


"Bob Phillips" wrote in message
...
Why would you replace code that is very clear, very obvious in its intent,
with code that is not, and offers no perceptible benefits.

In other words, why use 'clever' code just for its own sake.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Rick Rothstein (MVP - VB)" wrote in
message ...
But why what?...

Why did I post my formula? I thought readers of this thread (whether in
this newsgroup or in the Google archives) would be interested in seeing
the equivalence between the longer (direct) method that you posted and
the shorter (Mod function call) method that I posted.

Why is your code marginally quicker? It takes longer to execute a Mod
function than an If-Then test.

Some other why?

Rick


"Bob Phillips" wrote in message
...
But why?

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Rick Rothstein (MVP - VB)" wrote
in message ...
Just as a point of interest, these four lines from your code....

cnt = cnt + 1
If cnt 100000 Then
cnt = 0
End If

can be replaced by this single line...

cnt = (cnt + 1) Mod 100001

Although I would note your code is marginally quicker than what I
posted.

Rick


"Bob Phillips" wrote in message
...
Sub CountDown()
Static cnt As Long

Range("A1").Value = cnt
cnt = cnt + 1
If cnt 100000 Then

cnt = 0
End If

Application.OnTime Now + TimeSerial(0, 0, 1), "CountDown"

End Sub


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"SANDIND" wrote in message
...
Is there anyway by which i can make one cell to continously show
numbers
running from 0 to 100,000 and then again start from 0.

I have sheet where I refresh the external data and by the time data
is
refreshed I want one of the cells to show the pattern of running
numbers.









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to extract numbers from imported cell with text and numbers? jyin Excel Discussion (Misc queries) 3 March 28th 07 01:14 PM
Extract numbers from cell with Text and Numbers wiredwrx New Users to Excel 3 April 18th 06 10:57 PM
Help! How do you get excel to find the x(changes daily, marked in a cell from another formula) highest numbers in a group of numbers and sum them up? C-Man23 Excel Worksheet Functions 3 January 19th 06 09:52 AM
Help! How do you get excel to find the x(changes daily, marked in a cell from another formula) highest numbers in a group of numbers and sum them up? C-Man23 Excel Worksheet Functions 1 January 9th 06 01:23 PM
How do I extract numbers from a cell with both text and numbers? SHANNON Excel Worksheet Functions 8 December 2nd 05 02:31 AM


All times are GMT +1. The time now is 10:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"