Return to VBA Code Examples

VBA Clear Entire Sheet

In VBA it’s fast and easy to clear an entire sheet (or worksheet).

Clear ActiveSheet

Clear Everything (Contents, Formats, Comments, etc.)

This will clear the Activesheet’s cells of all cell properties: contents, formats, comments, etc:

Cells.Clear

Clear Contents

Instead, you can clear ONLY the cell contents:

Cells.ClearContents

Clear Formats

or only the Cell Formats:

Cells.ClearFormats

By typing: Cells.Clear into the VBA Editor you can see the list of Clear methods available to you:

vba clear entire sheet

 

Delete Worksheet UsedRange

You can also delete the entire worksheet’s UsedRange. This can also delete objects (shapes, charts, textboxes).

ActiveSheet.UsedRange.Delete

Clear Sheet (By Name)

To clear a specific sheet use the following code where “Sheet1” is the name of the sheet to clear:

Sheets("Sheet1").Cells.Clear

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users! automacro

Learn More!!

Clear Worksheet (From Variable)

To clear a sheet defined by an object variable use the following code:

dim ws as worksheet

Set ws = Sheets("Sheet1")

ws.Cells.Clear