By default, all cells are locked, so you first need to unlock
everything and then selectively lock the desired ranges. E.g.,
Sub AAA()
Dim WS As Worksheet
Set WS = Worksheets("Sheet1")
With WS
.Cells.Locked = False
.Cells(1, "J").Resize(.Rows.Count, 1).Locked = True
.Cells(62, "A").Resize(.Rows.Count - 61).Locked = True
.Protect
End With
End Sub
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Sat, 12 Sep 2009 11:58:49 -0700, "Ken"
wrote:
I would like to lock all cells starting from J1 to infinity and from A62 to
infinity using VB.
Anyone have any ideas?
Ken