Share via

Excel Macro to Copy a Specific Row and Insert it below the active cell row

Anonymous
2015-12-09T14:38:03+00:00

I have a template row in row 1 of the worksheet.

I want to copy and insert row 1 immediately below the row containing the cursor when I call the macro.

Tried recording macros, using relative references, etc.

Seems to me like I DON'T want to use relative reference to select and copy row 1, but do want to use relative reference to insert the copied row below the active cell row.

Any specific assistance greatly appreciated

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

Answer accepted by question author

  1. Anonymous
    2015-12-09T15:20:02+00:00

    Hi,

    Try this

    Rows(1).Copy

    ActiveCell.Offset(1).Insert

    Was this answer helpful?

    4 people found this answer helpful.
    0 comments No comments

8 additional answers

Sort by: Most helpful
  1. Anonymous
    2015-12-09T15:58:42+00:00

    in the row I am copying - the top row in the worksheet - I've inserted 2 checkboxes.

    Now that things are working I want to hide that row, but when I do that it "pushes down" the checkboxes so they now appear in Row 2.

    Hi,

    Glad that worked for you. Right click the checkbox | Format Control | Properties tab and select 'Move and size with cells' and when you hide the row the checkbox will be hidden too.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2015-12-09T15:43:42+00:00

    Hi,

    Try this

    Rows(1).Copy

    ActiveCell.Offset(1).Insert

    Now I feel even more stupid than before!!! not really a vba guy, but that was pathetically simple.

    follow up question if you are game.

    in the row I am copying - the top row in the worksheet - I've inserted 2 checkboxes.

    Now that things are working I want to hide that row, but when I do that it "pushes down" the checkboxes so they now appear in Row 2.

    Is there a way to keep this from happening? 

    thanks again

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2015-12-09T15:37:03+00:00

    ActiveCell.Offset(1, 0).EntireRow = Range("1:1").Value  'or Formula

    Gord

    Was this answer helpful?

    0 comments No comments
  4. Vijay A. Verma 104.8K Reputation points Volunteer Moderator
    2015-12-09T15:26:05+00:00

    You may use below one -

    Sub Insert1stRow()

        Dim ToRow As Long

        ToRow = ActiveCell.Row + 1

        Rows(1).Copy

        Range("A" & ToRow).Insert

        Application.CutCopyMode = False

    End Sub

    Was this answer helpful?

    0 comments No comments