Delete Entire Rows and Columns

Delete Rows and Columns using Excel Visual Basic

Deleting Rows using VBA

The basic format:

Rows([Row Number]).EntireRow.Delete

Substitute “[Row Number]” with the row number you want to remove. This moves all rows up. So if you chose to remove row 15, row 16 would become the new row 15, 17 would move up to 16 and on down the line of rows.


We want to remove the orange row:


That is row 15, our code may look like this:

Private Sub CommandButton1_Click()
End Sub

When executed, the sheet now looks like this:



Deleting Columns Using VBA

The basic format:

Columns([Column Number]).EntireColumn.Delete

Substitute “[Column Number]” with the column you wish to remove. This will move the columns to the right of the deleted area over. If you remove column “O” then column “P” will become the new “O” column, “Q” will become “P” and on down through the entire sheet.

We want to remove the orange column:


Private Sub CommandButton1_Click()
End Sub


Private Sub CommandButton1_Click()
End Sub

When the above code is executed, it will look like this:



Excel VBA Resources

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.