在thisworkbook中添加以下事件程序:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
On Error Resume Next
ActiveSheet.Unprotect "123"
Cells.Locked = False
Cells.SpecialCells(xlCellTypeConstants, 23).Locked = True
ActiveSheet.Protect "123"
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
ActiveSheet.Unprotect "123"
Cells.Locked = False
Cells.SpecialCells(xlCellTypeConstants, 23).Locked = True
ActiveSheet.Protect "123"
End Sub