运行时错误'1004':无法设置 范围类
代码是:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cl As Range
ActiveSheet.Unprotect
For Each cl In Target
If cl.Value <> "" Then
check = MsgBox("Is this entry correct? This cell cannot be edited after entering a value.", vbYesNo, "Cell lock Notification")
If check = vbYes Then
cl.Locked = True
Else
cl.Value = ""
End If
End If
Next cl
Dim i As Integer
For i = 9 To 20
If Cells(i, "A").Value <> "" And Cells(i, "B").Value <> "" _
And Cells(i, "C").Value <> "" And Cells(i, "D").Value <> "" _
And Cells(i, "E").Value <> "" And Cells(i, "F").Value <> "" _
And Cells(i, "G").Value <> "" And Cells(i, "H").Value <> "" _
And Cells(i, "I").Value <> "" And Cells(i, "J").Value <> "" _
And Cells(i, "K").Value <> "" And Cells(i, "L").Value <> "" _
And Cells(i, "M").Value <> "" And Cells(i, "N").Value = "" Then
Cells(i, "N").Value = Now
Cells(i, "N").NumberFormat = "h:mm:ss"
End If
Next i
Range("N9:N20").EntireColumn.AutoFit
ActiveSheet.Protect
End Sub