Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
For Each c In Target
With c
.AddComment
.Comment.Text Text:="" & Now
End With
Next
End Sub
如需要在j4:p5000范围内单元格中实现此功能,则改成:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
For Each c In Target
If c.Column > 9 And c.Column < 17 And c.Row > 3 And c.Row < 5001 Then
With c
.AddComment
.Comment.Text Text:="" & Now
End With
End If
Next
End Sub