|
- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim i As Integer
- On Error Resume Next
- Application.EnableEvents = False
- Dim r As Range
- For Each r In Selection
- If r.Column = 1 Then
- i = r.Row
- If Cells(i, 1) = "" Then
- Cells(i, 6) = ""
- Cells(i, 7) = ""
- Else
- Cells(i, 6) = Application.UserName
- Cells(i, 7) = VBA.Environ("computername")
- End If
- End If
- Next
- If Target.Count > 1 Then
- Application.EnableEvents = True
- Exit Sub
- End If
- If Target.Row > 2 And Target.Column = 2 Then
- Cells(Target.Row, 1) = Int(Now())
- End If
- Application.EnableEvents = True
- End Sub
复制代码 |
|