View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default How to enter a macro that performs when a file is closed

Use the before_close event
Alt+Fll to open VB editor. double click 'This workbook' and paste this in

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Sheet1").Visible = False
End Sub

Mike

"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?