Excel Macro to Copy Formulas to Rows Below

I am using Excel 2010.  I have formulas in cells A1:P1.  I would like to have a macro copy those formulas to the number of rows below row 1 that is expressed in cell Q1.  Q1 has a formula that counts the number of cells in another range that have numeric values.

 

Example:  Q1=10, the macro should copy the formulas in row 1 from row 1 to row 10.

One thought on “Excel Macro to Copy Formulas to Rows Below

  1. Katie

    Hi

    Try this macro…

    Sub CopyFormula()

    rownumber = Cells(1, 17) 'Cell Q1

    Range("A1:P1").Select

    Selection.Copy

    Range("A1").End(xlDown).Offset(1, 0).Select

    For X = 1 To rownumber Step 1
    Selection.PasteSpecial Paste:=xlPasteFormulas,
    Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Range("A1").End(xlDown).Offset(1, 0).Select
    Next X

    End Sub

    It copies all the row containing the formulas. The moves down to the next blank and pastes the formula. It then repeats this a number of times as specified by the number in cell Q1.

Leave a Reply

Your email address will not be published. Required fields are marked *