第1个回答 2011-11-25
你少了一句end if
ActiveSheet.Unprotect
Cells.Locked = False '先把所有单元格设置为不锁定的
For i = 3 To 63
If Cells(i, 1) = "正确" Then Cells(i, 2).Locked = True
Next
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
也可以改成以下代码
ActiveSheet.Unprotect
Cells.Locked = False '先把所有单元格设置为不锁定的
For i = 3 To 63
If Cells(i, 1) = "正确" Then Cells(i, 2).Locked = True
Next
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True本回答被提问者采纳
第3个回答 2011-11-24
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Cells(ActiveCell.Row, ActiveCell.Column - 1).Value = "确定" Then
Cells(ActiveCell.Row, ActiveCell.Column - 1).Select
end if
End Sub