double a 5 by 5 cell table
This is a general purpose macro that will work with any size table any wher
in the workbook
Set MyRange = Range("D5:H9")
NumRows = MyRange.Rows.Count
NumCols = MyRange.Columns.Count
LastRow = MyRange.Row + NumRows - 1
For RowCount = LastRow To (MyRange.Row + 1) Step -1
Set InsertRange = Range(Cells(RowCount, MyRange.Column), _
Cells(RowCount, MyRange.Column + NumCols - 1))
InsertRange.Insert shift:=xlDown
Next RowCount
LastRow = MyRange.Row + (2 * (NumRows - 1))
LastCol = MyRange.Column + NumCols - 1
For ColCount = LastCol To (MyRange.Column + 1) Step -1
Set InsertRange = Range(Cells(MyRange.Row, ColCount), _
Cells(LastRow, ColCount))
InsertRange.Insert shift:=xlToRight
Next ColCount
"Fan924" wrote:
I need a macro to take a 5 row by 5 column array with numbers in each
cell and split it into a 9 by 9 array with new blank cells.
|