Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select last cell in range

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

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Select last cell in range

cells(selection.end(xldown).row + 1, selection.column).select

"PaulSin " wrote in message
...
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 in
a load of new data.
I can use Selection.End(xlDown) fine to get to the last cell, but then
I want to offset one cell down. The code I have for the offset is
Cell.Offset(1,0).Select, but this comes back with an error saying it
needs an object. Any ideas on what I'm doing wrong?
Thanks
Paul


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Select last cell in range

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.

-----Original Message-----
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 in
a load of new data.
I can use Selection.End(xlDown) fine to get to the last

cell, but then
I want to offset one cell down. The code I have for the

offset is
Cell.Offset(1,0).Select, but this comes back with an

error saying it
needs an object. Any ideas on what I'm doing wrong?
Thanks
Paul


---
Message posted from http://www.ExcelForum.com/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Select last cell in range

Hi
Just put the offset bit directly after. eg
Selection.End(xlDown).Offset(1, 0).Select
-----Original Message-----
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 in
a load of new data.
I can use Selection.End(xlDown) fine to get to the last

cell, but then
I want to offset one cell down. The code I have for the

offset is
Cell.Offset(1,0).Select, but this comes back with an

error saying it
needs an object. Any ideas on what I'm doing wrong?
Thanks
Paul


---
Message posted from http://www.ExcelForum.com/

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select the first cell of the last row in a range - Excel 2003 Gary''s Student New Users to Excel 0 April 2nd 09 12:56 AM
how can I select a range of cells based on a value of a cell? grigoras victor Excel Discussion (Misc queries) 1 June 26th 06 04:55 PM
select first cell in unmerged range Jack Sons Excel Discussion (Misc queries) 2 October 20th 05 03:49 PM
How to select a range whose name is entered in a cell. JD Ami Excel Worksheet Functions 3 October 3rd 05 07:38 PM
select last cell in used range Tony P Excel Programming 1 January 7th 04 06:41 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"