Thread: set range
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jeff Jeff is offline
external usenet poster
 
Posts: 921
Default set range

Tom,
Sorry that I wasn't really specific. The spreadsheet that I have there
maybe empty spaces in the middle. So, the code you give here doesn't handle
that.
Also, From colA to ColZ they all end at the row (meaning that the absolute
row index for colA to Z will be the same). Is there a way to do that w/o a
loop?

spreadsheet looks sth like this.

row 1 Col A Col B ... Col Y Col Z
row 2
row 3 1 2 2 4
row 4 4 10 5 9

I'd like to select A4 thru Z4 in this case

Thanks



"Tom Ogilvy" wrote:

set rng = cells(rows.count,1).end(xlup)
do while application.CountA(rng.Resize(1,26)) < 0
set rng = rng.offset(1,0)
Loop
rng.resize(1,26).Select

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
Can someone please tell me how I can do the following?
I need a vb code to select last non-empty line of cells from Col A to Col

Z.

E.g. I have data from A1:Z107, I need to select A107:z107

Thanks.