ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   End of Spreadsheet (https://www.excelbanter.com/excel-programming/363625-end-spreadsheet.html)

Chas

End of Spreadsheet
 
Writing a VBA in Excel, how do I know if I am at the last row of data? The
column I am processing may have empty cells. But an adjourning cell will
always have something until the end of rows is reached. Is there an
equivalent EOF or do I examine the adjourning column as I process?



Jim Thomlinson

End of Spreadsheet
 
My preference is to create a range to seach and then traverse that range...
Something like this

dim rngToSearch as range
dim rng as range

with Sheets("sheet1")
set rngToSearch = .range("A2", .cells(rows.count, "A").end(xlUp))

for each rng in rngToSearch
msgbox rng.address
next rng
end with
--
HTH...

Jim Thomlinson


"Chas" wrote:

Writing a VBA in Excel, how do I know if I am at the last row of data? The
column I am processing may have empty cells. But an adjourning cell will
always have something until the end of rows is reached. Is there an
equivalent EOF or do I examine the adjourning column as I process?




Don Guillett

End of Spreadsheet
 
lastrow=cells(rows.count,"e").end(xlup).row
cells(lr,"d")=1

--
Don Guillett
SalesAid Software

"Chas" wrote in message
...
Writing a VBA in Excel, how do I know if I am at the last row of data?
The column I am processing may have empty cells. But an adjourning cell
will always have something until the end of rows is reached. Is there an
equivalent EOF or do I examine the adjourning column as I process?






All times are GMT +1. The time now is 04:05 PM.

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