![]() |
Add a comment when cells are changed
Hello
I have the range "D2:Q50" in the active sheet. I am looking for a macro that will automatically insert a comment ("changed by username on now") into the cell changed. I suspect that Private Sub Workbook_SheetChange plays a role here. If you could help, please. Regards |
Add a comment when cells are changed
How about something like this...
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Not Intersect(Target, Range("D2:Q50")) Is Nothing Then On Error Resume Next Target.Comment.Delete Target.AddComment "Changed by " & Application.UserName & " on " & Now End If End Sub -- Rick (MVP - Excel) "dimbroane" wrote in message ... Hello I have the range "D2:Q50" in the active sheet. I am looking for a macro that will automatically insert a comment ("changed by username on now") into the cell changed. I suspect that Private Sub Workbook_SheetChange plays a role here. If you could help, please. Regards |
Add a comment when cells are changed
Excellent, it's quite perfect. Thank you.
On Dec 1, 7:45*pm, "Rick Rothstein" wrote: How about something like this... Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) * If Not Intersect(Target, Range("D2:Q50")) Is Nothing Then * * On Error Resume Next * * Target.Comment.Delete * * Target.AddComment "Changed by " & Application.UserName & " on " & Now * End If End Sub -- Rick (MVP - Excel) "dimbroane" wrote in message ... Hello I have the range "D2:Q50" in the active sheet. I am looking for a macro that will automatically insert a comment ("changed by username on now") *into the cell changed. I suspect that Private Sub Workbook_SheetChange plays a role here. If you could help, please. Regards |
All times are GMT +1. The time now is 05:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com