1800-222-WTF

Excel & VBA

21 Feb 2018

Move Entire Row Up or Down

/
Posted By
/
Comments0

The Result

As you can see the end result is an effective tool than you or any of your users can put to use. Leave the copy & paste nightmare in the past!

Move Rows

Figure 1 – Move Rows Up or Down

The Problem

Everyone has a task tracking spreadsheet right? How often do you need to move a row up or down and find your self fighting somewhere in between Insert Row & Copy/Paste. If you have many rows to move up or down in your worksheet, this can be incredibly time consuming and frustrating.

Luckily, VBA can be of assistance here. Below is some handy Drag & Drop code you can use to move the entire row (of a selected cell) up or down in your worksheet.

The Code

The code is split into two procedures. Your highly developed detective skills should lead you to realize Procedure1 will be for moving rows UP and Procedure2 will be for moving rows DOWN.

Note that the first IF statement in both procedures, see Line 4,  limits the range that this macro will work on. So if the header rows starts on row 3 as in the example below, you would change the statement to:

Leave a Reply