ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert comment If cell content changes. (https://www.excelbanter.com/excel-programming/407804-insert-comment-if-cell-content-changes.html)

Les Stout[_2_]

Insert comment If cell content changes.
 
Hello all, I am trying to insert a comment if the content of a cell is
changed in a protected sheet. I have turned off "Move selection after
enter" on the Edit tab and i have put this in my code
"Application.MoveAfterReturn = False". But after enter it still jumps to
the next cell and then the comment gets put into the new cell and not
the altered cell. Is there a way to do this ??

Any help is much appreciated.

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

Gary''s Student

Insert comment If cell content changes.
 
Hi Les:

Use Target, not ActiveCell. You want something like:

Private Sub Worksheet_Change(ByVal Target As Range)
Target.AddComment
Target.Comment.Visible = True
Target.Comment.Text Text:="Hello World"
Target.Select
End Sub

--
Gary''s Student - gsnu2007g


"Les Stout" wrote:

Hello all, I am trying to insert a comment if the content of a cell is
changed in a protected sheet. I have turned off "Move selection after
enter" on the Edit tab and i have put this in my code
"Application.MoveAfterReturn = False". But after enter it still jumps to
the next cell and then the comment gets put into the new cell and not
the altered cell. Is there a way to do this ??

Any help is much appreciated.

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***



All times are GMT +1. The time now is 02:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com