password protection macro - HELP????

T

Teddy-B

I have set up a workbook that protects and unprotects every sheet in the
workbook with the following macros: (My problem is that I want to allow the
user to enter comments into the protected worksheets and I can't figure out
how to get the protection macro to allow this.) I know it has something to do
with "drawingobjects=false", but I can't squeeze it in.--------Please Help:

Sub protect_sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Protect Password:="****"
Next ws
'
End Sub


Sub Unprotect_sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Unprotect Password:="****"
Next ws
'
End Sub
 
M

Mike

The cell will need to be unlocked or if its a certain column just unlock that
column.
 
T

Teddy-B

Doeas anyone else have an idea on how to get this step into the macro so that
I won't have to manually do it?
 
G

Gord Dibben

Try this

Sub protect_sheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
With ws
.Protect Password:="justme", DrawingObjects:=False, _
Contents:=True, Scenarios:=True
'choose enableselection mode
' .EnableSelection = xlUnlockedCells
' .EnableSelection = xlNoRestrictions
End With
Next ws
End Sub


Gord Dibben MS Excel MVP
 
T

Teddy-B

Thanks "Gord" - You are the master! I would encourage evryone to macrotize
their spreadsheet(s) protection in multiple spreadsheet workbooks. It would
be cool if this were a built-in function for those of us who administer large
multi-sheet workwooks for the general staff - but the password would have to
be visible only as ******* in the macro :)

'CHEERS'
 

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