K
Ken
I would like to lock all cells starting from J1 to infinity and from A62 to
infinity using VB.
Anyone have any ideas?
Ken
infinity using VB.
Anyone have any ideas?
Ken
Protection was on.
Chip Pearson said:When you protect the worksheet via code, you can specify the
UserInterfaceOnly parameter as True. This setting prevents the user
from changing a locked cell, but allows VBA to do whatever it wants
with no restrictions.
ThisWorkbook.Worksheets("Sheet1").Protect UserInterfaceOnly:=True
This setting is NOT preserved if you close and reopen the workbook, so
you will likely want to set it when the workbook is opened. In the
ThisWorkbook module, use code such as the following:
Private Sub Workbook_Open()
Worksheets("Sheet1").Protect UserInterfaceOnly:=True
' repeat for desired worksheets
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)