View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Clear a cell's contents when document is saved

hi
AFAIK there isn't a non macro way to do it.
try this.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Sheet1").Range("A4").ClearContents
Sheets("Sheet1").Range("A6").ClearContents
End Sub

this is workbook code. press Alt+F11 to bring up the VB editor. in the
project window(far left), expand your project(file). double click
ThisWorkbook. in the code window,(far right) click the left dropdown at the
top and click this workbook.

Private Sub Workbook_Open() should default in. delete it and paste the above
in in it place.

if you don't like the before close event, you can try the before save event
but this would clear the cells out each time you save the file.

adjust the ranges and sheet name to suit.

Regards
FSt1


"Gary" wrote:

Is there a non-macro way to clear a cell's contents automatically when the
spreadsheet is saved?

This is one of several un-locked cells in my spreadsheet and I want to
clear 1 or 2 specific cells each time a document is closed. I have hidden
notes (a price list) that are only visible via Conditional formatting color
change from white to black if a password is entered in the cell I want to
clear upon Saving or exiting a document to prevent the next user, possibly a
customer, from seeing the notes (price list) if not authorized.

If I need a macro, what would you suggest?

Also, if I send my spread to other users, will the macro work? Must they
choose "Enable Macros?" each time the document is opened?