标题: EXCEL单元格填充后怎样自动添加时间批注代码? [打印本页] 作者: 刘晓强 时间: 2013-7-11 14:58 标题: EXCEL单元格填充后怎样自动添加时间批注代码? 作者: 淡写轻描 时间: 2013-7-11 15:09
Private Sub Worksheet_Change(ByVal TargetAs Range) On Error Resume Next For Each c In Target With c .AddComment .Comment.Text Text:=&quot;&quot; & Now End With NextEnd Sub如需要在j4:p5000范围内单元格中实现此功能,则改成:Private Sub Worksheet_Change(ByVal TargetAs 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:=&quot;&quot; & Now End With End If NextEnd Sub