View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
steve steve is offline
external usenet poster
 
Posts: 5
Default Lock and password protect only cells with formulas on all sheets i

Hi Mike,

Your code works great!
Thanks for your help, very much appreciated.

Cheers,

Steve

On Sun, 9 Jul 2006 09:24:49 -0400, "Mike Fogleman"
wrote:

I use this for a large workbook and have a keyboard assignment for each. the
password is not unique to each sheet, it is always "fcc". However, I also
password protect the code (project) with another password, so my code cannot
be viewed.

Sub unpro()

' Keyboard Shortcut: Ctrl+u
'
Dim w As Worksheet
For Each w In Worksheets
w.Unprotect ("fcc")
Next
End Sub
Sub protect()

' Keyboard Shortcut: Ctrl+p
'
Dim w As Worksheet
For Each w In Worksheets
w.protect Password:="fcc"
Next
Sheet20.Unprotect ("fcc")
Sheet65.Unprotect ("fcc")
End Sub

Sheets 20 & 65 are a hidden database and a menusheet so I never want them
protected. All other sheets I had pre-set the cells property manualy for
locked or unlocked because they have different layouts.

Mike F
"steve" wrote in message
.. .
Thanks for your feedback Tom.

I have tried to record a macro to perform all the steps but the macro
is not able to record the assignment of a unique password to the
sheet. It will only lock the cells.

Any other suggestions?
Are you aware of any VB code that could do the trick?

Cheers,

Steve

On Sat, 8 Jul 2006 16:37:01 -0700, Tom Ogilvy
wrote:

No. You must protect each sheet individually, but you can do it in a
macro.