PDA

View Full Version : expand selection starting from dynamic range



asddsa88
05-04-2010, 10:02 AM
Hello,

here is the problem,

I select a list of contiguous cells with
ActiveSheet.Range("a1", ActiveSheet.Range("a1").End(xlDown)).Select


now I want to expand the selection to the next 5 rows

example, the macro selects 10 contiguous cells, now I need to expand the selection form column A to column F KEEPING the 10 cells original selection lenght.

if I use
activecell.Resize(0, 5).Select

it works, but only for the 1st row, the rest of the selection is gone ...



I would need to use something like an "activerange.resize" altough it doesn't exist in excel..

any ideas?

asddsa88
05-04-2010, 10:06 AM
problem solved...

Selection.Resize(Selection.Rows.Count + 0, _
Selection.Columns.Count + 5).Select

mdmackillop
05-04-2010, 12:41 PM
Offset is a bit neater

With ActiveSheet
Range(.Cells(1, 1), .Cells(1, 1).End(xlDown).Offset(5)).Select
End With