Insert comment If cell content changes.

L

Les Stout

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 ***
 
G

Gary''s Student

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top