Way to by pass PW to hide sheet

C

Cam Hua

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!
 
C

Chip Pearson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top