An input file of data is processed using VBA to create an Excel(2003) protected spreadsheet(Invoice).
The spreadsheet is then to be distributed to other offices where some designated cells are to be amended.
How can I create the worksheet to allow these cells to be amended when the whole sheet is protected?
I have tried using the code below, and other similar variations, but it does not seem to work.
Can you help?
Private Sub CellLock1()
Cells.Select
' unlock all the cells
Selection.Locked = False
' lock only these cells
Range("J49:K49").Select
Selection.Locked = True
ActiveSheet.Protect DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
UserInterfaceOnly:=True, _
AllowFormattingCells:=True, _
AllowFormattingColumns:=True, _
AllowFormattingRows:=True, _
AllowInsertingColumns:=True, _
AllowInsertingRows:=True, _
AllowInsertingHyperlinks:=True, _
AllowDeletingColumns:=True, _
AllowDeletingRows:=True, _
AllowSorting:=True, _
AllowFiltering:=True, _
AllowUsingPivotTables:=True
End Sub
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…