ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   loop till no more data (https://www.excelbanter.com/excel-programming/439321-loop-till-no-more-data.html)

SLP

loop till no more data
 
Hi,

How to I fix this so the loop stops when there is no more rows with data on
it? The number of rows will change each time the tool is used and I don't
want to have to guess every few days as to what number to use. Thanks much.

Sub MyLoop
For c = 1 to 1500
Call AllocateNew
Next c
End Sub



Don Guillett[_2_]

loop till no more data
 
dim lr as long
lr=cells(rows.count,"a").end(xlup).row
for c=1 to lr

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"SLP" wrote in message
...
Hi,

How to I fix this so the loop stops when there is no more rows with data
on
it? The number of rows will change each time the tool is used and I don't
want to have to guess every few days as to what number to use. Thanks
much.

Sub MyLoop
For c = 1 to 1500
Call AllocateNew
Next c
End Sub




SLP

loop till no more data
 
Thanks...I'll give that a try tomorrow. Enjoy the rest of your day!

"SLP" wrote:

Hi,

How to I fix this so the loop stops when there is no more rows with data on
it? The number of rows will change each time the tool is used and I don't
want to have to guess every few days as to what number to use. Thanks much.

Sub MyLoop
For c = 1 to 1500
Call AllocateNew
Next c
End Sub



SLP

loop till no more data
 
Thanks. I'll try that tomorrow. Enjoy the rest of your day!

"Don Guillett" wrote:

dim lr as long
lr=cells(rows.count,"a").end(xlup).row
for c=1 to lr

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"SLP" wrote in message
...
Hi,

How to I fix this so the loop stops when there is no more rows with data
on
it? The number of rows will change each time the tool is used and I don't
want to have to guess every few days as to what number to use. Thanks
much.

Sub MyLoop
For c = 1 to 1500
Call AllocateNew
Next c
End Sub



.



All times are GMT +1. The time now is 07:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com