ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I clear cell content when excel document is closed? (https://www.excelbanter.com/excel-worksheet-functions/14971-how-do-i-clear-cell-content-when-excel-document-closed.html)

m3155

How do I clear cell content when excel document is closed?
 
I am trying to clear the content of some "data" cells when I close the excel
document, without having to go to "edit,clear,content" route. Is this
possible?

Springbok

Hold and click Ctrl+F11 to open the VB editor. In the 'Project - VBA Project
window" find and double click on "ThisWorkbook". Then paste this code...
(Change range to suite)

Private Sub Workbook_Close()
Range("E6:G15").Select
Selection.ClearContents
End Sub

"m3155" wrote:

I am trying to clear the content of some "data" cells when I close the excel
document, without having to go to "edit,clear,content" route. Is this
possible?



All times are GMT +1. The time now is 12:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com