PDA

View Full Version : Solved: Worksheet Protection except Specific Column



Ann_BBO
11-10-2009, 05:35 AM
Hi All,

How to protect the worksheet except a specific column. (e.g. Column I)

Sub Protect()
Columns("I:I").Select
ActiveSheet.Protect Password:="abc"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

Here is my code but it is protect all sheet.

Thanks,
Ann

Bob Phillips
11-10-2009, 05:36 AM
Unlock that column, Format>Cells>Protection

Ann_BBO
11-10-2009, 05:53 AM
Hi xld,

Solved. Thanks
Sub Protect()
Columns("I:I").Select
Selection.Locked = False
Selection.FormulaHidden = False
ActiveSheet.Protect Password:="abc"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub


Ann

Bob Phillips
11-10-2009, 05:57 AM
don't bother with the select



Sub Protect()
With Columns("I:I")

.Locked = False
.FormulaHidden = False
End With
ActiveSheet.Protect Password:="abc"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub