How to easily reorder rows in excel with drag and drop or move-up or move-down?
- Select the row/column.
- Move your mouse cursor to the row/column's boundary so that you see the four-way-arrow cursor (or hand cursor on a Mac).
- Press Shift on your keyboard, then click and drag the row/column.
The Shift key shifts the row/column instead of overwriting the target row/column.
This is still a cut/paste method, but is the simplest way I can think of.
4-click solution: (eg. move row 8 above row 5)
- Right click row number (eg. row 8), click Cut (or T)
- Right click row number (eg. row 5), click Insert Cut Cells (or E)
Note: This also works for moving multiple rows.
Add the following macros to your Personal Macro Workbook and assign them shortcut keys. The behaviour mimics Sublime Text's Swap Line Up & Swap Line Down.
Sub move_rows_down()
Dim rOriginalSelection As Range
Set rOriginalSelection = Selection.EntireRow
With rOriginalSelection
.Select
.Cut
.Offset(rOriginalSelection.rows.Count + 1, 0).Select
End With
Selection.Insert
rOriginalSelection.Select
End Sub
Sub move_rows_up()
Dim rOriginalSelection As Range
Set rOriginalSelection = Selection.EntireRow
With rOriginalSelection
.Select
.Cut
.Offset(-1, 0).Select
End With
Selection.Insert
rOriginalSelection.Select
End Sub
For snobs like me who want to use keyboard only:
- Select the cells you want to move (rows or columns, or any rectangle of cells, but the selection must be contiguous)
- Press Ctrl+x (Ctrl+c would let you make two copies.)
- Move to or select the cell immediately after where you want to move the content (below it, or to the right.) This cell will not move.
- Press Ctrl++. This will shift cells down or to the right. (Ctrl+v would overwrite cells instead.)
On the Mac, all of these shortcuts work the same with either Ctrl or ⌘.