Copying formula to the next row when inserting a new row

前端 未结 5 634
轮回少年
轮回少年 2021-02-12 15:05

I have a row in which there are formulas using values of the same row. The next row is empty, just with a different background color.

Now, if I insert a new row (by righ

5条回答
  •  忘了有多久
    2021-02-12 15:54

    You need to insert the new row and then copy from the source row to the newly inserted row. Excel allows you to paste special just formulas. So in Excel:

    • Insert the new row
    • Copy the source row
    • Select the newly created target row, right click and paste special
    • Paste as formulas

    VBA if required with Rows("1:1") being source and Rows("2:2") being target:

    Rows("2:2").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Rows("2:2").Clear
    
    Rows("1:1").Copy
    Rows("2:2").PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone
    

提交回复
热议问题