Return to VBA Code Examples

VBA ClearContents / Clear Cells

In VBA it’s easy to clear cells or cell properties with the .Clear methods.

VBA Clear Cells / Ranges

Type the following into the VBA Editor.

This will display all of the Clear methods available to you:

vba clear cells

As you can see, You can clear:

  • Everything ( .Clear)
  • Comments ( .ClearComments)
  • Contents ( .ClearContents)
  • Formats ( .ClearFormats)
  • Hyperlinks ( .ClearHyperlinks)
  • Notes ( .ClearNotes)
  • Outline ( .ClearOutline)

VBA ClearContents

The most common clear method is ClearContents. ClearContents clears only the contents of cells (cell values / text). It does not clear formatting, comments, or anything else.

vba clearcontents

ClearContents is the same as pressing the Delete key on your keyboard.

You can also clear the contents of an entire range of cells:

VBA Clear

Clear will clear all cell properties from a cell:

vba clear

VBA Programming | Code Generator does work for you!

VBA Clear Formatting

To clear cell formatting use ClearFormats

vba clear formats

Clear Selection

To clear the current selection:

Clear Entire Sheet

To clear an entire worksheet: