View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default 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!