MS Excel VBA - Clear cell contents with one click

Submitted by techrev on Tue, 08/15/2017 - 11:55

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)

insert activex controls button











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

draw command button and view code















Step 3 : Insert following snippet



Private Sub CommandButton1_Click()
End Sub

code snippet







Step 4 : Save the workbook as macro enabled excel file

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