Protect a Cell in an Editable Range

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

All

I have a spreadsheet as illustrated below:

A B
1 ab ef
2 gh
3 ij

that I have run the Sub below on:

Sub LockCells()

Range("A2", Cells.SpecialCells(xlLastCell)).Name
= "UsedCells"
ActiveSheet.Protection.AllowEditRanges.Add
Title:="Body", Range:=Range("UsedCells")
ActiveSheet.Protect "abc123",
DrawingObjects:=True, Contents:=True, Scenarios:=True

End Sub


What I am trying to do is lock an individual cell in a
named range where editing is allowed. i.e. after the
sheet is protected prevent editing on B2 and A3 as these
cells have no values. Any assistance would be
appreciated.

Thanks
 
I don't have Excel XP here to try it, but maybe you could re-protect the
blank cells with something like:
Intersect(Range("UsedCells"), Cells.SpecialCells(xlCellTypeBlanks))
 
Back
Top