End of Spreadsheet

  • Thread starter Thread starter Chas
  • Start date Start date
C

Chas

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?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top