我们在工作中使用excel工作表来记录我们的培训时间和人员。我们的员工使用USB徽章读取器扫描到工作表以确认他们参加了我们的培训。
我想知道当员工从键盘错误中扫描其徽章时,是否可以锁定某些单元以防止错误,但仍允许允许徽章扫描的宏正常工作。
到目前为止,当工作表被部分或完全锁定时,宏似乎无法运行。
我已经在下面包含了我们要运行的代码。
Private Sub Worksheet_Change(ByVal Target As Range)
' Dim i As Integer
' MsgBox (Target.Row & ":" & Target.Column)
' For i = 8 To 200
If Target.Column = 3 And Target.Row <= 12 Then
If Cells(Target.Row, Target.Column).Value <> "" And Cells(Target.Row, "E").Value = "" Then
' Cells(Target.Row, "E").Value = Now()
' Cells(Target.Row, "E").NumberFormat = "h:mm AM/PM"
End If
End If
' Next
' Range("E:E").EntireColumn.AutoFit
' End Sub
' Private Sub Worksheet_Change(ByVal Target As Range)
' Dim i As Integer
' MsgBox (Target.Row & ":" & Target.Column)
' For i = 8 To 200
If Target.Column = 1 And Target.Row <= 17 Then
If Cells(Target.Row, Target.Column).Value <> "" And Cells(Target.Row, "B").Value = "" Then
Cells(Target.Row, "B").Value = Now()
' Cells(Target.Row, "F").NumberFormat = "h:mm AM/PM"
End If
End If
' Next
' Range("F:F").EntireColumn.AutoFit
' End Sub
' Private Sub Worksheet_Change(ByVal Target As Range)
' Dim i As Integer
' MsgBox (Target.Row & ":" & Target.Column)
' For i = 8 To 200
If Target.Column = 3 And Target.Row >= 15 Then
If Cells(Target.Row, Target.Column).Value <> "" And Cells(Target.Row, "D").Value = "" Then
Cells(Target.Row, "D").Value = Now()
Cells(Target.Row, "D").NumberFormat = "m/d/yyy"
End If
End If
' Next
Range("D:D").EntireColumn.AutoFit
End Sub