- Computers & Software»
- Computer Science & Programming»
- Programming Languages
Insert, Delete & Clear: Rows, Columns, and Cells in VBA
As you begin to write code some of the most common tasks you will find yourself doing are inserting, deleting and clearing ranges of cells.
Deleting vs. Clearing
Deleting a range completely removes a range of cells from your workbook (both contents and formatting). The other cells on the sheet will shift as a result of the cell being deleted.
Clearing Contents is the equivalent of pressing the delete key while a cell is selected. It clears the characters contained in the cell while retaining the actual cell and its fromatting.
Clearing a Range
Deleting a Range
When deleting a range you have the choice of shifting the remaining cells on the sheet to the left or up.
Delete Range, Shift Up
Delete Range, Shift Left
Inserting A Range
When inserting a range you have the choice of shifting the other cells on the sheet to right or down.
Insert Range, Shift Cells Down
Insert Range, Shift Cells Right
Clearing a Row
Deleting a Row
Note: Deleting a row will shift the rows below up.
Inserting a Row
Note: Inserting a row will shift the rows below down.
Clearing a Column
Deleting a Columns
Note: Inserting a column will shift the columns to the left.
Inserting a Column
Note: Inserting a column with shift columns to the right.
Ready to Proceed?
Now that we have learned some of the basics we are ready to perform repetitive tasks. The next module explains how to create a loop. Click here when you are ready to proceed.