Delete a row
How to delete a single row in a worksheet using Excel, VBA and Shortcut methods
1. Select an entire row where you want to delete a row. Note: in the example we are deleting the second row. To select an entire row, either click on the row number or select the first cell of the row, press and hold the Ctrl and Shift keys and press the Right key. |
2. Right-click anywhere on the selected row and click Delete. |
METHOD 2. Delete a row using the ribbon option
EXCEL
1. Select any cell in the same row that you want to delete. Note: in this example row 2 will be deleted, given we have selected a cell in the second row. |
2. Select the Home tab. |
3. Click Delete in the Cells group. 4. Click Delete Sheet Rows. |
METHOD 3. Delete a row using the cell option
EXCEL
1. Right-click on any cell in the same row that you want to delete. 2. Click Delete Note: in this example row 2 will be deleted, given we have right-clicked on a cell in the second row. |
3. Select the Entire row option and click OK group. |
Worksheets("Sheet1").Range("A2").EntireRow.Delete
End Sub
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
ADJUSTABLE PARAMETERS
Row Selection: Select the row that you want to delete by changing the row number reference ("A2"). You can also change the column reference to any column as this will have no impact on where the row will be deleted.
Worksheet Selection: Select the worksheet where you want to delete a row by changing the Sheet1 worksheet name.
Worksheets("Sheet1").Range("A2:D2").EntireRow.Delete
End Sub
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
ADJUSTABLE PARAMETERS
Row Selection: Select the row that you want to delete by changing the row number reference ("A2:D2"). You can also change the column reference to any column as this will have no impact on where the row will be deleted.
Worksheet Selection: Select the worksheet where you want to delete a row by changing the Sheet1 worksheet name.
METHOD 3. Delete a row using VBA by selecting an entire row
VBA
Worksheets("Sheet1").Range("2:2").EntireRow.Delete
End Sub
Worksheets: The Worksheets object represents all of the worksheets in a workbook, excluding chart sheets.
ADJUSTABLE PARAMETERS
Row Selection: Select the row that you want to delete by changing the row number reference ("2:2").
Worksheet Selection: Select the worksheet where you want to delete a row by changing the Sheet1 worksheet name.
NOTES
To delete a row using this shortcut method you will need to select an entire row and then action the shortcut. If you select a single cell or a range of cells and action this shortcut a Delete dialog box will appear and you will need to select Entire row and click OK.
This tutorial explains and provides step by step instructions on how to delete a single row in a worksheet using Excel, VBA and Shortcut methods.
Excel Methods: Using Excel you can delete a row by selecting an entire row or a single cell and using a ribbon or cell option.
VBA Methods: Using VBA you can delete a row by referencing to a single cell, a range of cells or an entire row. If you want to delete a single row by referencing to a range of cells you need to ensure that the range of cells only references to a single row. As per the example in this tutorial the VBA code references to only row 2 across multiple columns ("A2:D2").
Shortcut Methods: Using a Shortcut you can delete a row by selecting an entire row that you want to delete and then actioning the shortcut.
ADDITIONAL NOTES
Note 1: Deleting a row will move the existing rows that are below the deleted row upward. In this this tutorial every row below row 2 will be moved up.