我已经读了你的帖子很长时间了,他们在我的日常工作中帮了很多忙。
这是我第一次问你一个具体的问题。
我有一个代码可以跟踪sheet1中工作簿上的任何更改(更改日志)。我还想跟踪所有格式更改(即,当单元格的内部颜色发生变化时)。它可以列为ColorIndex。
你能帮我提一些想法或代码吗??
当前代码:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
vOldVal = Target
End Sub
Public Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
With Application
.ScreenUpdating = False
.EnableEvents = False
.DisplayAlerts = False
End With
If IsEmpty(vOldVal) Then vOldVal = "<blank>"
bBold = Target.HasFormula
With Sheet1
With .Cells(.Rows.Count, 1).End(xlUp)(2, 1)
.Value = Target.Parent.Name
.Offset(0, 1) = Target.Address(False, False)
.Offset(0, 2) = vOldVal
If Target = "" Then
.Offset(0, 3).Value = "<blank>"
Else
.Offset(0, 3).Value = Target
End If
.Offset(0, 4) = Time
.Offset(0, 5) = Date
.Offset(0, 6) = (Environ$("Username"))
End With
End With
vOldVal = vbNullString
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub