ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Way to by pass PW to hide sheet (https://www.excelbanter.com/excel-programming/316541-way-pass-pw-hide-sheet.html)

Cam Hua

Way to by pass PW to hide sheet
 
Hello,

I have a sheet in my workbook that need to be protected, then hidden. I
need to write a macro to perform these task.
I ran into the problem with the macro because the sheet can not be
protected in order to be protected. It gave me an error.

Is there a way in the macro to protected the sheet then hide the sheet
by ignoring the protection? Thanks

Cameron

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Chip Pearson

Way to by pass PW to hide sheet
 
Try some code like the following:

Dim WS As Worksheet
Set WS = Worksheets("Sheet1")
WS.Visible = xlSheetHidden
WS.Protect Password:="ThePassword"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Cam Hua" wrote in message
...
Hello,

I have a sheet in my workbook that need to be protected, then
hidden. I
need to write a macro to perform these task.
I ran into the problem with the macro because the sheet can not
be
protected in order to be protected. It gave me an error.

Is there a way in the macro to protected the sheet then hide
the sheet
by ignoring the protection? Thanks

Cameron

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 10:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com