-
expand selection starting from dynamic range
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?
-
problem solved...
Selection.Resize(Selection.Rows.Count + 0, _
Selection.Columns.Count + 5).Select
-
Offset is a bit neater
[VBA]
With ActiveSheet
Range(.Cells(1, 1), .Cells(1, 1).End(xlDown).Offset(5)).Select
End With
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules