175

I have to do some manual reordering or rows in Excel and cut/paste is too hard to use. I'm looking for something that would enable me to use drag'n'drop or to add some buttons to move-up/down move-top/bottom.

Linker3000
  • 27,498
  • 3
  • 52
  • 73
sorin
  • 11,660
  • 20
  • 63
  • 73

10 Answers10

254
  1. Select the row/column.
  2. 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).
  3. 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.

Patrick McElhaney
  • 923
  • 4
  • 13
  • 25
kok
  • 2,549
  • 1
  • 14
  • 3
  • 23
    On mac, for step two you want to move your mouse cursor so that you see the hand icon, not the four-way-arrow cursor. – Scott Ritchie Jun 12 '14 at 02:11
  • 2
    I have Excel 2013 and it seems the default behavior now when you move a row after seeing four-way-arrow cursor is shifting behavior. Pressing SHIFT actual replaces destination row – Korayem Jun 30 '15 at 21:31
  • 1
    I have Office365 (so I think I have whatever is latest version of Excel at time of post - I can't find a proper version number anywhere). Selecting ANY group of cells (not just rows/columns), moving to border to get 4-way arrow, and dragging moves data around - leaving an empty hole behind. Dropping it warns on overwrite. Shift+dragging attempts to reorder rows or columns, but only if full row/column selected. "Full" = all of some rectangular area - not necessarily full spreadsheet. // Confusion: must hover over boundary of data cells, not the row number or column letter - that resizes. – Krazy Glew Jul 18 '17 at 18:19
  • 1
    Does anyone know of a shortcut to get this "4-way arrow" - keyboard shortcut, or a macro / Visual Basic (or whatever the new macro language is called)? I find it really hard to do this precisely with a mouse, let alone on a touchscreen or with a pen. Ideally I would like to have a "thumb" to drag rows and columns around like this. – Krazy Glew Jul 18 '17 at 18:21
  • 1
    Does anyone know how to do this Google Sheets? – Krazy Glew Jul 18 '17 at 18:41
  • In Google Spreadsheet you can easily drag and drop rows and columns just selecting them and dragging from the number/letter. – soneangel Aug 23 '17 at 07:17
  • kok made one awesome answer and was never seen again! Who was that masked man? – CindyH Aug 29 '18 at 20:25
  • As @Korayem commented above, pressing SHIFT actually defaults to overwrite-mode on my environment (Office 365 ProPlus). Left-clicking the four-way-arrow (without SHIFT) actually does the row moving without overwriting. – satoc Apr 19 '19 at 06:42
  • Unfortunately Excel does not allow this when the row/column to be moved contains a merged cell. It does not matter if the destination place would contain the same merged cell. – pabouk - Ukraine stay strong Oct 14 '19 at 08:57
  • SHUT UP AND TAKE MY UP VOTE! – mattboy Nov 15 '19 at 07:28
  • Wow, this does work. At first I didn't think it did because there's a very tiny spot you have to have your mouse. On a Mac, your mouse has to be (for a row) right on the line. Too far left and you'll be over the row number, too right right and you'll be over the cell. But just on the line the pointer will change into a hand. – philfreo Nov 04 '22 at 19:07
19

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)

  1. Right click row number (eg. row 8), click Cut (or T)
  2. Right click row number (eg. row 5), click Insert Cut Cells (or E)

Note: This also works for moving multiple rows.

wilson
  • 4,902
  • 2
  • 22
  • 39
  • This is a mouse-only solution without drag-and-drop, so that it is good at moving rows to further position which need scrolling. Otherwise, [@kok's answer](http://superuser.com/a/314526/43356) is more elegant. – wilson Mar 30 '16 at 09:05
  • thanks, also this still worked for me, kok's is better but iitially a bit longer to understand and one has to see the boundary button although its not necesarilly harder, one has to get used to it – FantomX1 Sep 04 '19 at 14:47
5

For snobs like me who want to use keyboard only:

  1. Select the cells you want to move (rows or columns, or any rectangle of cells, but the selection must be contiguous)
  2. Press Ctrl+x (Ctrl+c would let you make two copies.)
  3. 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.
  4. 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 .

Joshua Goldberg
  • 362
  • 2
  • 12
mattboy
  • 206
  • 2
  • 2
  • Neither the `Shift + mouse-drag` solution from @kok, nor this technique, will work with a discontinuous selection. Even if you select a contiguous region with separate Ctrl-clicks, Excel will get confused, so you must either Shift-click or drag to select the region to cut. – Joshua Goldberg Aug 10 '20 at 18:31
  • Step 4: `Ctrl` + `Shift` + `+` worked for me. And also, Step 3: selection must be equal column selection as coped for it to shift down or right. – spcsLrg Oct 15 '20 at 18:04
4

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
tjmcewan
  • 408
  • 6
  • 9
2

In dealing with similar cases in the past, where I could not just sort by a row, I found way to generate a column with a formula result that was something I could sort on.

I found a more direct answer to your question from this site:

Microsoft Word has a feature which Excel is lacking. Jon's method involves moving the data to Word, employing the Word command and then pasting the data back to Excel. Follow these steps.

  1. Copy the relevant chunk of rows and columns out of your speadsheet. It is best to note the size of the range, e.g., 118 rows x 5 columns
  2. Paste the data into a Microsoft Word document, where it automatically becomes a table and retains all your formatting.
  3. In Word, use the little-known SHIFT-ALT-UP-ARROW and SHIFT-ALT-DOWN-ARROW to very speedily slide rows (or selected chunks of rows) up and down at will. Select one or more rows. You can select the entire row or just a portion of the row as shown here.

    enter image description here

    Hit Shift+Alt+UpArrow several times in order to quickly slide the rows up into position.

    enter image description here

  4. When you have sequenced the rows as you like, paste them back into Excel, making sure you overwrite the exact same size chunk you copied.

Gaff
  • 18,569
  • 15
  • 57
  • 68
jzd
  • 328
  • 2
  • 9
  • Sweet! I do wish there was a way to do this in Excel or OneNote. // (Excel does special mouse drags, as noted above, but I lack mouse.coordination for this.) // It is unfortunate that one gives up other Excel goodness, like table sorting by column values, to get this word goodness – Krazy Glew Jul 18 '17 at 18:27
2

In Mac, use Command + Shift while dragging. I suppose that in windows it should be Win + Shift.

Marko
  • 304
  • 4
  • 6
  • 19
pablol
  • 21
  • 1
2

Try:

Shift + Space bar or mouse click on the line number to select the line

Ctrl + X to cut

Mouse click where you want it.

Ctrl + V to paste it

Excellll
  • 12,627
  • 11
  • 51
  • 78
Graham
  • 65
  • 1
1

A slight improvement on @wilson's answer:

Right click row number (eg. row 8), hit "t" Right click row number (eg. row 5), hit "e"

Mixing use of the mouse and keyboard really speeds it up for me.

Codemonkey
  • 441
  • 3
  • 10
  • 26
1

Here is a sub that also works for columns; it combines the functionality for all four directions:

Sub MoveRowsOrColumns(direction As String)
    Dim rOriginalSelection As Range

    Select Case direction
    Case "up", "down"
        Set rOriginalSelection = Selection.EntireRow
    Case "left", "right"
        Set rOriginalSelection = Selection.EntireColumn
    Case Else
        Debug.Assert False
    End Select

    With rOriginalSelection
        .Select
        .Cut
        Select Case direction
        Case "up"
            .Offset(-1, 0).Select
        Case "down"
            .Offset(rOriginalSelection.Rows.Count + 1, 0).Select
        Case "left"
            .Offset(0, -1).Select
        Case "right"
            .Offset(0, rOriginalSelection.Columns.Count + 1).Select
        End Select
    End With
    Selection.Insert
    rOriginalSelection.Select
End Sub
Mokubai
  • 89,133
  • 25
  • 207
  • 233
Micromegas
  • 11
  • 1
-1

This is the easiest one I found. Can't really drag and drop:

For example to move row 3 before row 2:

  • right click on row 3 (on the number 3 at left) and select Cut
  • right click on row 2 (on the number 2) and select Insert Cut Cells
mrudult
  • 334
  • 1
  • 4
  • 15