Select last cell in range

  • Thread starter Thread starter PaulSin
  • Start date Start date
P

PaulSin

I can't remember how I did this last time.....
I've got a range of cells and I need to go to the last cell to paste i
a load of new data.
I can use Selection.End(xlDown) fine to get to the last cell, but the
I want to offset one cell down. The code I have for the offset i
Cell.Offset(1,0).Select, but this comes back with an error saying i
needs an object. Any ideas on what I'm doing wrong?
Thanks
Pau
 
cells(selection.end(xldown).row + 1, selection.column).select
 
Paul,

the problem here is that the OFFSET needs to be based on a
Range object. Despite it's sugestive name, Cell isn't one,
although it's entirely possible that it was an Object
variable in the earlier code you had.

Once you get to the bottom of the region, you can use:

ActiveCell.Offset(1,0).Select

Alternatively, you can combine the two into:

ActiveCell.End(xlDown).Offset(1,0).Select

However, this method can be susceptible to errors caused
by unexpected breaks or blanks in your data, so it's often
best to work from the bottom up:

Range("A65536").End(xlUp).Offset(1,0).Select

Cheers, Pete.
 
Hi
Just put the offset bit directly after. eg
Selection.End(xlDown).Offset(1, 0).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