I have this code that I got from another site, however, this code allows the user to enter a comment without the UserInput window, the only problem is that it leaves the comment window open and it won't close when the user selects another cell.
How do I modify this so that when the user is done with the comment, and the user selects another cell to get the focus out of the comment box, the box will close?
Code:
Sub CommentAddOrEdit()
'method suggested by Jon Peltier 2006-03-04
'adds new plain text comment or adds text
'at end of existing comment text
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
Set cmt = ActiveCell.AddComment
cmt.text text:=""
End If
'type to add comment text to selected shape
cmt.Visible = True
cmt.Shape.Select
End Sub
How do I modify this so that when the user is done with the comment, and the user selects another cell to get the focus out of the comment box, the box will close?