How to NOT show a certain page on start-up

bonconsul

New Member
Joined
Oct 11, 2019
Messages
14
Hello,

I have a sheet with login details per user and I as administrator am the only one who can see it. Now if I accidently save the file when I am on that sheet and close the workbook, anyone after that opening the excel will see that sheet while the macro is running to go autoamtically to another welcome sheet.

Is there a way to avoid that the last sheet shown at the moment of save is visible during the opening of the workbook?

Wouter
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
hide it before close and save.
And don't show it unless necessary.

VBA Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ThisWorkbook.Worksheets("Sheet1").Visible = xlSheetVeryHidden
End Sub
 
Upvote 0
hide it before close and save.
And don't show it unless necessary.

VBA Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ThisWorkbook.Worksheets("Sheet1").Visible = xlSheetVeryHidden
End Sub
Hey Bobsan, thanks a lot!
The thing is that it only works when you also save it at the time you close the workbook. If I saved it before (with the sheet that I want to hide open) and close without saving, it will nowt work.
Perhaps I can do a macro WHILE saving?
 
Upvote 0
more like BeforeSave:
VBA Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    ThisWorkbook.Worksheets("Sheet1").Visible = xlSheetVeryHidden
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,566
Messages
6,125,593
Members
449,237
Latest member
Chase S

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