|
楼主 |
发表于 2019-10-12 14:49
|
显示全部楼层
http://club.excelhome.net/forum.php?mod=viewthread&tid=1439027&ordertype=1我找到一个 试了一下 也看的有点名表 大神帮着看看 他这个只能记录单个单元格内容的修改 像通过拖拽填充的 没法记录全部的,您看看怎么改Public temp
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
r = Sheets("修改记录").[A65535].End(3).Row + 1
l = Target.Column
Sheet2.Cells(r, 1) = Target.Address(0, 0) '单元格
Sheet2.Cells(r, 2) = Cells(2, l) '科目
Sheet2.Cells(r, 3) = temp '修改前
Sheet2.Cells(r, 4) = Target.Value '修改后
Sheet2.Cells(r, 5) = Now()
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count = 1 Then
temp = Target.Value
Else
MsgBox "一次只能修改1个单元格"
Exit Sub
End If
End Sub
|
|