Run Macro On Exit

  • Thread starter Thread starter DM - NPS
  • Start date Start date
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
 
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....
 
Back
Top