PDA

View Full Version : Solved: Select numerous cells from active cell



Mr.G
06-01-2009, 12:06 AM
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.....
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

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

mdmackillop
06-01-2009, 04:15 AM
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

Mr.G
06-01-2009, 04:36 AM
Thank you mdmackillop.

Perfect.