How To Delete Cell Content In Excel With Simple VBA

Do you do the same thing over and over again in Excel, want to get automating with some simple macros and VBA, here is a great one to get started.

Lost of people would either use the same template or Excel worksheet and manually select the cells to clear by highlighting them.  Here is a great way with a simple piece of VBA to automate this procedure if you always  delete the same cells – like I do then this small piece of code will do the trick

Option Explicit

Sub  ClearCell()


‘ The above clears all cells, but you can if specify a range that you regularly delete for example’

 ‘  substitute the “Selection” for “Range(“A1:D5″)”, or your suitable’

‘  range.’

 End Sub

It is really easy to install this piece of code.

  1. Open Excel
  2. Right click on the sheet you want to install the code in
  3. Hit view code
  4. Copy the code above and paste it into the window where the cursor is flashingClose the VBA window

In my example I have chosen to delete A2 to D5, this way I can keep my column headings as I re use these over and over again.

Give this one a go and let us know how much time you save?

Do you know another way to do this?- share it with other Excellers……….

Other Excel Tips You Might Like

1.Protect An Excel Workbook

2. Number rows in an Excel Table

3. Delete values form cells but keep formulas

4. Transpose Excel data from rows to columns in a flash!


    • Barbara says


      Yes It could be attached to a Command Button
      Just Create A button and assign the Macro You created to it. Should be good to go.

  1. Kimberly` says

    Is there way to delete only some data in a column with a VBA?

    I have a very large worksheet that contains information grouped and separated by a row between each group. One of the columns has redundant information for each row of each group. I only want to keep the information in that specific column for the first row of the group and delete the other information in that column for the other rows in the group. I do not want to delete any of the information for the groups that appear in the other columns. Any help would be greatly appreciated.


Leave a Reply

Your email address will not be published. Required fields are marked *