Code Formula

N

Nikki

All:
I am in need of code help for inserting a formula down a column of 26 rows.
I typed the formula and copied it down to the last cell but that will not
work for the next time I use the macro since it will be the next column. Any
help is greatly appreciated.

Thanks
Nikki
 
J

JBeaucaire

Short and sweet, this code will copy the currently selected cell down to
a total of 26 rows, 25 copies.

Code:
--------------------
Sub Copy26Rows()
Selection.Copy
Range(Selection, Selection.Offset(25, 0)).PasteSpecial (xlPasteFormulasAndNumberFormats)
Selection.End(xlDown).Select
Application.CutCopyMode = False
End Sub
 
N

Nikki

Thanks so much. One other question, if I wanted to copy say five rows down
and then use a sum formula that is directly to the left (copy preceeding cell
to the left), how could I incorporate this into this code. I could use the
same code and modify the formula but was hoping one line would give me what I
would need.

Thanks again.
 
R

Rick Rothstein

I'm pretty sure this shorter macro will do the same thing your code does...

Sub Copy26Rows()
Selection.Copy Selection.Resize(26)
End Sub
 
Top