View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Fan924 Fan924 is offline
external usenet poster
 
Posts: 238
Default double a 5 by 5 cell table

Thanks Joel. :}
I temporarily modified the code to add blank columns only. After it
runs, I would like to fill all blank cells with a formula "=RC[-1]/
2+RC[1]/2". The idea is to double the size of a table then filling the
new cells with the average value of the cells to the left and right.

Sub double()
Dim MyRange As Range
Set MyRange = Selection
NumRows = MyRange.Rows.Count
NumCols = MyRange.Columns.Count
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
End Sub