A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi,
Try this
Rows(1).Copy
ActiveCell.Offset(1).Insert
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
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.
Answer accepted by question author
Hi,
Try this
Rows(1).Copy
ActiveCell.Offset(1).Insert
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.
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
ActiveCell.Offset(1, 0).EntireRow = Range("1:1").Value 'or Formula
Gord
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