|
请将以下代码帮助改为单元格中的公式结果发生变化时也自动记录日志,现在的代码是单元格输入数据或删除数据时才会触发记录日志,请帮助解决,万分感谢Dim XX
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
If Sh.Name <> "日志" And Target.Rows.Count = 1 Then
With Sheets("日志")
If XX <> Target Then
ROW1 = Sheets("日志").[A65536].End(xlUp).Row + 1
.Cells(ROW1, 1) = Format(Now, "yyyy-mm-dd hh:mm:ss")
.Cells(ROW1, 2) = Sh.Name
.Cells(ROW1, 3) = XX
.Cells(ROW1, 4) = Target.Value
.Cells(ROW1, 5) = Target.Address
End If
End With
End If
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
XX = Target.Value
End Sub |
|