-
Solved: Select numerous cells from active cell
Hi
I would like to find out how do I change a macro to work from the active cell. The recorded Macro looks like this.....
[VBA]Sub Macro2()
' Macro2 Macro
Range("J9:O24").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
End Sub[/VBA]
Now where it selects the Range, I would like to select 3 cells right and 8 cells down, and then merge the whole lot. Then you could select any cell in w/s and run the macro.
Thank you
-
[VBA]Sub Macro2()
With ActiveCell.Resize(8, 3)
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
End Sub
[/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'
-
Thank you mdmackillop.
Perfect.
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