|
|
|
|
|
|
Excel
|
Clear Contents on Open
|
|
Ease of Use
|
Easy
|
Version tested with
|
2000
|
Submitted by:
|
Anne Troy
|
Description:
|
Clear the contents of a cell on open of the workbook.
|
Discussion:
|
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.
|
Code:
|
instructions for use
|
Private Sub Workbook_Open()
Range("C6").Select
Selection.ClearContents
End Sub
|
How to use:
|
- Copy the code above.
- Open the workbook in question.
- Hit Alt+F11 to open the Visual Basic Editor (VBE).
- On the left, double-click ThisWorkbook under your workbook's name.
- Paste the code into the code window that appears at right.
- Save with the Save diskette on the toolbar and close the VBE.
|
Test the code:
|
- Type a value into the cell and save and close the file.
- Open the file and the cell should be empty.
|
Sample File:
|
onopen.zip 5.48KB
|
Approved by mdmackillop
|
This entry has been viewed 186 times.
|
|