Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Why doesn't Selection.End(xlDown).Select always work?

If you can select the cell and manually do End then hit the down arrow key
and it works, it should work with code.

This will stop at the last contiguous cell that is not empty.

It sounds like some of the cells maybe non-empty, but look empty.
If that is the case, you may have to loop - however, you might be able to
reduce the amout of looping with

Dim rng as Range
set rng = cells(rows.count,1).End(xlup)
do while rng.Text = ""
set rng = rng.offset(-1,0)
Loop
rng.Select

--
Regards,
Tom Ogilvy

"Andy" wrote in message
...
Hi,
I am trying to get the next free row using
Selection.End(xlDown).Select
Sometimes it seems to work, sometimes not.
Is there something else I need to know about this? I've currently given up

and am using a do look looking for the next emply cell, but its a bit of a
fudge, and won't win any 'pretty code' contests!

Any help would be appreciated.
Many thanks in advance.



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
Why doesn't Selection.End(xlDown).Select always work? Don Guillett[_4_] Excel Programming 0 August 3rd 04 05:47 PM
Excel VBA - Range(Selection, Selection.End(xlDown)).Name issue. jonH Excel Programming 3 June 7th 04 09:13 PM
Select the next row after xldown range ExcelMonkey[_108_] Excel Programming 2 March 5th 04 10:03 PM
Selection.End(xlDown) with Rows selected Tokash Excel Programming 1 August 19th 03 03:52 PM
Selection.End(xlDown) with Rows selected norman Excel Programming 0 August 19th 03 01:45 AM


All times are GMT +1. The time now is 07:03 PM.

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"