Clear Contents on Open

Ease of Use


Version tested with


Submitted by:

Anne Troy


Clear the contents of a cell on open of the workbook. 


You may use a workbook to get values and want the criteria cell cleared whenever you open the file, but the file may have been saved with the criteria in the cell. Just use this macro. 


instructions for use


Private Sub Workbook_Open() 'change C6 to your desired cell Range("C6").Select Selection.ClearContents End Sub

How to use:

  1. Copy the code above.
  2. Open the workbook in question.
  3. Hit Alt+F11 to open the Visual Basic Editor (VBE).
  4. On the left, double-click ThisWorkbook under your workbook's name.
  5. Paste the code into the code window that appears at right.
  6. Save with the Save diskette on the toolbar and close the VBE.

Test the code:

  1. Type a value into the cell and save and close the file.
  2. Open the file and the cell should be empty.

Sample File:

onopen.zip 5.48KB 

Approved by mdmackillop

This entry has been viewed 181 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2014 VBA Express