Run Macro On Exit

D

DM - NPS

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
 
C

Corey

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....
 
Top