21, Feb, 2019

MS Excel VBA – Clear cell contents with one click

excel vba

A simple VBA code to clear the contents of cells (all) with one button click

Steps are as shown below

Step 1 : Go to developer tab and insert a button from Activex Controls  (make sure that Design mode is enabled)

Step 2 : Draw a button any where in the cells array then right click to view code

Step 3 : Insert following snippet



Private Sub CommandButton1_Click()
End Sub

Step 4 : Save the workbook as macro enabled excel file

Step 5 : You can change Range(“A1:Z100”) to any range you prefer

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>