protecting worksheet corrupts file

J

John S.

Ok I this is my situation , I protect a worksheet through a macro and
save the file. Open the file up again the sheet says it protected but it
dose not save the xlunlockedcells part. I can just run a code that
covers that only and it works, but still won't save that part. If I run
the protect code more than once the file corrupts. If I protect the
sheet manually using the tool bar everything works correctly. This has
been the same with two separate computers, I never had this problem with
2003, but it is showing up with the 2007 ver. My question is: is this a
common problem, is there a work around, why would protecting the file
the manual way only work. I know this is a strange question but it's
driving me crazy. Thanks for any help.
 
G

Gord Dibben

Post your code.

Mine looks like this...................

Sub SHEETPROTECT()
With ActiveSheet
.Protect Password:="justme", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
.EnableSelection = xlUnlockedCells
End With
End Sub


Gord Dibben MS Excel MVP
 

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