How to enter a macro that performs when a file is closed
I wouldn't hide the sheet when the workbook closes.
After your code hides it, your code will have to save the workbook. If the user
opened the workbook and destroyed 90% of the data and decides to close without
saving, your code just screwed up the workbook.
Instead, I'd hide the worksheet when the workbook opens.
Option Explicit
Sub Auto_Open()
thisworkbook.worksheets("Somesheetname").visible = xlsheethidden
end sub
You could use the workbook_open event if you wanted instead.
Leanne wrote:
I want a sheet to be hiden when the file is closed.
I have done the code to unhide it should the user require but because of
this I want it hiden again when the file is closed (if it has been unhiden)
Can any one tell me where/how I write this?
--
Dave Peterson
|