ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   For..Next loop problem (https://www.excelbanter.com/excel-programming/291671-next-loop-problem.html)

Dwaine Horton

For..Next loop problem
 
I have a spreadsheet that I need to load data from another spreadsheet. The spreadsheet I want the data loaded into is a template and the other spreadsheet can have one to N rows. How can I progammaticly find out how many rows I have in my second spreadsheet and then use that in my for..next loop

Thank

Dwaine Horto
York International

Bob Phillips[_6_]

For..Next loop problem
 
Dwaine,

You determine a key column, and then working up from the final row in the
spreadsheet until you hit a cell with data

cLastRow = Cells(Rows.Count,"A").End(xlUp).Row

change A for your column.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Dwaine Horton" wrote in message
...
I have a spreadsheet that I need to load data from another spreadsheet.

The spreadsheet I want the data loaded into is a template and the other
spreadsheet can have one to N rows. How can I progammaticly find out how
many rows I have in my second spreadsheet and then use that in my for..next
loop?

Thanks

Dwaine Horton
York International





All times are GMT +1. The time now is 10:24 AM.

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