ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to find the number of used rows in a spreadsheet? (https://www.excelbanter.com/excel-programming/371684-how-find-number-used-rows-spreadsheet.html)

Grd

How to find the number of used rows in a spreadsheet?
 
Hi,

I have a FOR NEXT loop that runs for each row in a sheet. However the number
of rows changes so I keep having to go in and type the new number for eg if
there are 80 rows I type

For i =1 to 80

Is there a way of substituting the 80 dynamically so excel knows how many
rows there are on a spreadsheet.

This would help me out greatly.

Thanks for any help

Sandra

Don Guillett

How to find the number of used rows in a spreadsheet?
 
lastrow=cells(rows.count,"a").end(xlup).row
for i=1 to lastrow


--
Don Guillett
SalesAid Software

"Grd" wrote in message
...
Hi,

I have a FOR NEXT loop that runs for each row in a sheet. However the
number
of rows changes so I keep having to go in and type the new number for eg
if
there are 80 rows I type

For i =1 to 80

Is there a way of substituting the 80 dynamically so excel knows how many
rows there are on a spreadsheet.

This would help me out greatly.

Thanks for any help

Sandra





All times are GMT +1. The time now is 12:01 AM.

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