View Full Version : Protect only selected cells
Good Morning,
I need to protect only some cells of a column, for example column H, from H16 to H 139 by a macro. Is there a little help.
Thanks
hi sasa, try this:
to unlock go to tools-> Protection->Unprotect sheet
Sub x()
'
' Macro4 Macro
' Macro recorded 3/28/2009 by joms
'
'
Cells.Select
Selection.Locked = False
Selection.FormulaHidden = False
Range("h16:h139").Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
mdmackillop
03-28-2009, 06:48 AM
Tidying up Joms' code to get rid of these inefficient selections
Sub x()
With Cells
.Locked = False
.FormulaHidden = False
With .Range("h16:h139")
.Locked = True
.FormulaHidden = False
End With
End With
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
thanks, mdmackillop... that code was just recorded... at i least i learn something from you... :)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.