Skip to content

Copying/Moving Rows and Columns with Excel VBA

    Copy a single row

    'Copy row 3 to row 13
    Sub CopyRow()
    Rows(3).Copy
    Rows(13).Insert
    End Sub

    Move a single row

    'Move row 3 to row 5
    Sub MoveRow()
    Rows(3).Cut
    Rows(6).Insert
    End Sub

    Move multiple rows

    'Move rows 7-9 to row 3-5
    Sub MoveMultipleRows()
    Rows("7:9").Cut
    Rows(3).Insert
    End Sub

    Move a single column

    'Move column C to column D
    Sub MoveColumn()
    Columns("C").Cut
    Columns("E").Insert
    End Sub

    Move multiple columns

    'Move columns C & D to columns E and F
    Sub MoveMultipleColumns()
    Columns("C:D").Cut
    Columns("G:H").Insert
    End Sub

    Move a row to another worksheet

    'Move row to another worksheet
    Sub MoveRowToAnotherSheet()
    Rows(3).Cut
    Worksheets("Sheet2").Rows(3).Insert
    End Sub

    Move a row to the end of the table

    'Move row to end of table
    Sub MoveRowToEndOfTable()
    Rows(3).Cut
    'reference the first cell in your table in the next line of code
    Range("B2").End(xlDown).Offset(1, 0).EntireRow.Insert
    End Sub