protected sheet

S

Shlomit

I protected sheet in macro with the following code but not all the column was
protected?

Worksheets("GiveGetDB").Protect Contents:=True

Any one can help?

Thanks,
shlomit
 
D

Dave Peterson

If some of the cells in those columns are unlocked (format|Protection tab), then
those cells can still be changed.
 
S

Shlomit

So how can I lock all the cells and protected the sheet in the macro?

Thanks,
Shlomit
 
G

Gord Dibben

To lock all the cells and protect the sheet........

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


Gord Dibben MS Excel MVP
 
Top