Using last row in macros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to be able to select the last row which contains data and use the row
number in a macro to select all the cells in a column from the top to the
last row. The number of rows varies each time the macro is run.
 
lr=cells(rows.count,"a").end(xlup).row
range(cells(1,"a"),cells(lr,"a")).copy range("b3")

You rarely need to select but if you insist
lr=cells(rows.count,"a").end(xlup).row
range(cells(1,"a"),cells(lr,"a")).select
 

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