View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Corey[_3_] Corey[_3_] is offline
external usenet poster
 
Posts: 25
Default Run Macro On Exit

Use the Workbook BeforeClose event like:
ALT+F11 to access VBA
Select the Before Close Option and place the required code to hide/display
sheets there.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheet1.Visible = False
Sheet2.Visible = true
.....
End Sub


Corey....

"DM - NPS" wrote in message
...
I have 6 worksheets in an Excel Workbook. When on click on the "X" to
close
the workbook I want a macro to automatically run that hides 3 of the 6
worksheets. Any ideas on how to do this?

thanks