admin管理员组文章数量:1312982
I have a code that automatically timestamps on "A" when there's data on the next cells, and delete the date on "A" if I delete the entries, but sometimes I need to do correct previous dates and do manual entries, so I need to stop this code. I need a command button or macro to pause this code and when pressing again, run it again
Private Sub Worksheet_Change(ByVal Target As Range)
Const ColumnsToMonitor As String = "b:f"
Const DateColumn As String = "a"
Application.EnableEvents = False
If Not Intersect(Target, Columns(ColumnsToMonitor)) Is Nothing Then
With Intersect(Target.EntireRow, Columns(DateColumn))
.Value = Date
.NumberFormat = "ddd d/mm"
End With
End If
On Error Resume Next
If Target = "" Then
Intersect(Target.EntireRow, Columns(DateColumn)).ClearContents
End If
Application.EnableEvents = True
End Sub
本文标签: excelhow to make a macro to stop and then run a codeStack Overflow
版权声明:本文标题:excel - how to make a macro to stop and then run a code - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741840089a2400448.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论