View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Selecting a range without referring to specific cells

Range("A1").Resize(1,12).Select

selects A1:L1

however, you say it varies, so you could use something like

Range(Range("A1"),Range("A1").End(xltoRight)).Sele ct

Offset displaces from the specified location - if you want to expand, you
can use Resize

Range("A1").Resize(1,Range("A1").End(xltoright).Co lumn).Select

as another example.

You can also come from the right
Range("A1").Resize(1,Range("IV1").End(xltoLeft).Co lumn).Select

or
Range(Range("A1"),Range("IV1").End(xltoLeft)).Sele ct

--
Regards,
Tom Ogilvy


abxy wrote in message
...
I've "discovered" the .Offset term in VBA and I see how it's used. I can
select a cell to start at, then I can offset the selection by column
and row to get to a desired cell. So, now i'm wondering can I use this
offset function in combination with anything else to start in column A
and make a selection that ranges from column A to L? I can't specify a
range by cells becuase the data that I paste in always varys in length.


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