Skip to content

Instantly share code, notes, and snippets.

@scorchio
Created December 19, 2013 11:12
Show Gist options
  • Select an option

  • Save scorchio/8037669 to your computer and use it in GitHub Desktop.

Select an option

Save scorchio/8037669 to your computer and use it in GitHub Desktop.
VBA example code for clearing a worksheet
Sub ClearSheet()
Dim sheetToClear As Worksheet
Set sheetToClear = ActiveSheet ' Replace this with the sheet reference
' Delete something specific...
' sheetToClear.Cells.ClearFormats
' sheetToClear.Cells.ClearContents
' sheetToClear.Cells.ClearHyperlinks
' ...or every kind of data in the cells
sheetToClear.Cells.Clear
End Sub
@WSwarm
Copy link
Copy Markdown

WSwarm commented Dec 19, 2013

Nice, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment