Before close request

Pauljj

Well-known Member
Joined
Mar 28, 2004
Messages
2,035
I have a sheet called Promotions, when a user closes the workbook, I need to make sure the Promotions sheets is hidden, so when it is re-opened the user cannot see it, could someone help me on this please

Cheers
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Hi: Actually, you probably mean Before Save

Use the ThisWorkbook Before Save Event and include this line
Code:
WorkSheets("Promotions").Visible = xlSheetHidden

lenze
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Actually, I spoke too quickly. You will probably want to use the Before_Close event like this.
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Worksheets("Promotions").Visible = xlSheetHidden
    Me.Save
End Sub

This will allow you to save the book without closing and not hiding the sheet.

lenze
 

Forum statistics

Threads
1,136,263
Messages
5,674,710
Members
419,521
Latest member
Jasonnie

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top