This article is talking about clearing specified cell contents when opening or closing an Excel workbook.
Please do as follows to clear specified cell contents on workbook open and exit.
Firstly, you need to save the workbook which you need to clear specified cell contents on open or exit as an Excel Macro-enabled Workbook.
1. Please click File > Save As > Browse. See screenshot:
2. In the Save As dialog box, please select a folder to save the workbook, enter a new name into the File name box as you need, select Excel Macro-Enabled Workbook from the Sava as type drop-down list, and then click the Save button.
3. In the popping up Microsoft Excel dialog box, please click the OK button as below screenshot shown.
4. Open the Macro-Enabled Workbook you have saved just now, press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.
5. In the Microsoft Visual Basic for Applications window, double click ThisWorkbook in the left pane, and then copy below VBA code into the Code window.
VBA code 1: Clear specified cell contents on workbook open
VBA code 2: Clear specified cell contents on workbook exit
Note: In the above codes, test, and A1:A11 is the worksheet name and cell range you will clear contents from. Please change them as you need.
6. Press the Alt + Q keys to exit the Microsoft Visual Basic for Applications window.
From now on, when opening or closing the workbook, specified cell contents in certain worksheet will be cleared automatically.