Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Inserting and Copying Rows.

Inserting and Copying Rows

Written by Allen Wyatt (last updated June 24, 2020)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


8

As you are editing worksheets, you may notice that some of your work is done based on work you have done before. For instance, you may have a row of data that you entered in a previous Excel session. In this session, you need to copy that row of data and use it as the basis for your new data, but with a few changes.

In such a situation, it would be nice to have a quick way to enter a blank row after the current row, and copy the data in the current row to the new blank row. There are no intrinsic commands in Excel to do this, but a macro can do it very handily. Consider the following example:

Sub InsertCopyRow1()
    ActiveCell.EntireRow.Select
    Selection.Copy
    Selection.Insert Shift:=xlDown
End Sub

In order to use the macro, all you need to do is select a cell in any row. When the macro is run, a duplicate of the current row is inserted just below the row you are in.

The only problem with this solution is that it leaves the Excel interface a bit "messy" (for lack of a better word). When completed, a complete row is still selected, and the new row has the "marching ants" marquee around it.

This problem can be overcome by including commands to collapse the selection and move it to a desired location. Another way is to simply use a different macro that relies on different VBA commands. The following macro will also insert and copy a row, but it leaves the cell that you selected active:

Sub InsertCopyRow2()
    ActiveCell.Offset(1, 0).EntireRow.Insert
    ActiveCell.EntireRow.Copy ActiveCell.Offset(1, 0).EntireRow
End Sub

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10917) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Inserting and Copying Rows.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Designing Standard Tables

If you have a common table layout that you want to use again and again, you'd benefit by having an easy way to save that ...

Discover More

Absolutely Positioning a Graphic

Want a graphic to appear at a precise place on the page? It's easy to gain control by following the steps in this tip.

Discover More

Specifying Date Formats in Headers

Don't like the default date format used by Excel when you place the date in a header or footer? You can use a macro to ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Making a Named Range Non-Scrollable

Excel provides a few ways that you can freeze or split what you see in your worksheet. The appropriateness of these tools ...

Discover More

Deleting Blank Columns

Import data from another program, and you could end up with a lot of blank columns in your data. Here's the quickest way ...

Discover More

Spreading Out Worksheet Rows

If someone sends you a worksheet that has lots of data in it, you might want to "spread out" the data so you can have ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 + 5?

2020-06-25 09:10:27

dpc

@Kiwerry, my bad. You need to select the row beneath the one you want copied down. Selecting a row and using Ctrl & "+" will always insert a row above.


2020-06-24 12:31:15

Kiwerry

@ DPC Thanks for suggesting a very short key sequence; when I tried it the Ctrl & "+" inserted a row above the one I had selected, so I ended up with the row above the one I had selected being duplicated. Is there a setting somewhere which affects how Ctrl & "+" works?


2020-06-24 09:17:48

dpc

Select the row then Ctrl+"+" (insert) then Ctrl+d (copy down)
no marching ants


2020-06-24 03:00:39

Rene

Seems a difficult way of copying a row. Easier is to select the row and then Ctrl+C (copy), Ctrl+"+" (paste). This pastes the row above the one copied. If you want to place the row below the one copied, move down a row before using Ctrl+"+".
This also works for columns. Also works for moving a row or column (Ctrl+X = cut) and avoids macros.
Press Esc to remove the "marching ants".


2019-06-09 10:50:29

Willy Vanhaelen

This macro leaves the selectrion untouched and removes the "marching ants":

Sub InsertCopyRow1()
ActiveCell.EntireRow.Copy
ActiveCell.EntireRow.Insert
Application.CutCopyMode = False
End Sub


2015-01-13 09:04:20

Glenn Case

Actually, I prefer to have the inserted row highlighted. To remove the "marching ants" around the row which was copied from, use

Application.CutCopyMode = False

If you don't want the highlighted row, then you can select a single cell as follows:

Cells(Selection.Row,1).Select

You can, of course, change the 1 to refer to whichever column you'd prefer to have selected. Both of the above lines added to the first macro in the tip should get the desired effect.


2015-01-12 05:46:32

Willy Vanhaelen

You don't need a macro do do this:
- highlight the entire row you want to copy
- press Ctrl + C and Ctrl + plus key


2015-01-12 03:31:53

Kiran

Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(Ctry, 0)).EntireRow.Insert shift:=xlShiftDown

Not working after some loops

Pls advise


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.