Share via

macros to insert rows

Anonymous
2012-01-20T00:01:53+00:00

Hi

Looking for a macro to insert new rows and copy the formula from above on two identical sheets.

I have a row (Ref 715) adding all the data from the above rows. so I want the new row insertion just above

Row 715 on both the sheets.

Thanks for any support.

Kris

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2012-01-20T02:50:51+00:00

    Should I add both the codes together. I'm new to VBA.

    I copied the first code, it worked and subsequently I changed the revised

    code provided above, and it says cannot be executed.

    Additionally instead of telling the macro to add at Row 715, Can we change it to look

    at the last row under Column A which has got a text "Total" and add row above this Row.

    Sorry to bother you but your help is much appreciated

    thanks

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-01-20T01:51:27+00:00

    This does it for Sheet1 & Sheet2:

    Sub MAIN()

    ary = Array("Sheet1", "Sheet2")

    Dim sh As Worksheet

    For Each sh In Sheets(ary)

        sh.Activate

        Call I715KM

    Next

    End Sub

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2012-01-20T01:38:16+00:00

    Thanks Gary,

    Is it possible to simultaneiously add the rows in the other sheet?

    Cheers

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2012-01-20T01:34:31+00:00

    Here is an example for a single sheet.  It inserts two blank rows above row #715. This pushes row #715 down to row #717.  The macro goes to row #714 and copies each formula in that row down to the next two (newly inserted) rows:

    Sub I715KM()

    Range("715:715").Insert shift:=xlDown

    Range("715:715").Insert shift:=xlDown

    For Each r In Intersect(Range("714:714"), Cells.SpecialCells(xlCellTypeFormulas))

        r.Resize(3, 1).FillDown

    Next

    End Sub

    Was this answer helpful?

    0 comments No comments