range selection object code

  • Thread starter Thread starter Biologist Mike
  • Start date Start date
B

Biologist Mike

Looking for the proper object code for using relative address logic (like
offset) in the range selection object to select multiple fields and rows
(block of cells) where I don't know the exact cell reference but only an
offset value. I use xldirection all the time but that only goes to the end
of a continuous block of cells with values. I need code that will allow me
to grab, say 2 or 3 columns of data at a time.
 
I think you are looking for the Resize method. Consider this example. Let's
say you wanted to select a range 3 cells wide by 5 cells high where the
upper left cell of that range was to be offset from the active cell 2 rows
down and 4 columns over...

ActiveCell.Offset(2, 4).Resize(5, 3).Select

So, if C3 was your active cell, then the above statement would select G5:I9.
 
Back
Top