File/Cell Protection

  • Thread starter Thread starter FrankB
  • Start date Start date
F

FrankB

I have files whereby I have certain cells LOCKED. When I
put the password protection on from the file itself
everything works fine and it only protects certain cells
that I have locked and leaves the unlocked cells available
for data entry, however when I call it up from a VBA
statement it looks the entire worksheet. The code is
below.

Thanks
Frank


Workbooks.Open Filename:= _
"G:\04Plan\Cap Models\Project Managers\1040 Cap
Model.xls"
Application.Calculate
Sheets("Vertical").Select
Selection.Locked = False
Selection.FormulaHidden = False
ActiveSheet.Protect Password:="1040",
DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.Save
ActiveWorkbook.Close
 
Frank,

You haven't specified a selection in sheet Vertical before you do
Selection.Locked = False.
I'd guess (haven't tried it, but I think it remembers the cell selection as
it was for that sheet when the file was saved) that whatever the selection
happens to be when the file is opened is what gets unlocked. Everything
else stays locked (unless unlocked previously).
 
-----Original Message-----
Frank,

You haven't specified a selection in sheet Vertical before you do
Selection.Locked = False.
I'd guess (haven't tried it, but I think it remembers the cell selection as
it was for that sheet when the file was saved) that whatever the selection
happens to be when the file is opened is what gets unlocked. Everything
else stays locked (unless unlocked previously).

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------




.
Thanks Earl, however maybe I am going at this the wrong
way. The worksheet has probably 1,000 cells on it and I
am trying to lock the user out of about 900 of them and
only allow them input to the other 100. In this way they
can tab only to the cells where they can input date. If I
am not mistaken your suggestion only looks at one cell.
Also there is no specific range so I cannot use a range
either.

Thanks
Frank
 
Back
Top