ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   My CommentBox is Visible Afterwards (https://www.excelbanter.com/excel-programming/364588-my-commentbox-visible-afterwards.html)

JimMay

My CommentBox is Visible Afterwards
 
I'm trying to get this going
And it works fine, Except after running
And editing a comment (after clicking outside the
Comment box the Comment Box is still selected or at least
Displayed. I have to NOW - at the menu click on View
Comments to turn the display (of it) off.
What can I do (within the Macro) to achieve this?
TIA,

Sub EditComment()
'method suggested by Jon Peltier 2006-03-04
'adds text at end of existing comment text
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
Exit Sub
End If
'type to add comment text to selected shape
cmt.Visible = True
cmt.Shape.Select << the Box comes up and I edit my comment

End Sub


Leith Ross[_578_]

My CommentBox is Visible Afterwards
 

Hello JimMay,

To get this to work, the comment's Visible property must be set to
False when the editing is done. This can be detected when a different
cell on the Worksheet is selected.

Place this code in each Worksheet's SelectionChange event procedure...

Dim cmt As Comment
For Each cmt In ActiveSheet.Comments
cmt.Visible = False
Next cmtPrivate Sub Worksheet_SelectionChange(ByVal Target As Range)

The result should look like this...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cmt As Comment
For Each cmt In ActiveSheet.Comments
cmt.Visible = False
Next cmt
End Sub

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=552913


JimMay

My CommentBox is Visible Afterwards
 
Thank you Leith;
It works great
Jim

"Leith Ross"
wrote in message
:

Hello JimMay,

To get this to work, the comment's Visible property must be set to
False when the editing is done. This can be detected when a different
cell on the Worksheet is selected.

Place this code in each Worksheet's SelectionChange event procedure...

Dim cmt As Comment
For Each cmt In ActiveSheet.Comments
cmt.Visible = False
Next cmtPrivate Sub Worksheet_SelectionChange(ByVal Target As Range)

The result should look like this...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cmt As Comment
For Each cmt In ActiveSheet.Comments
cmt.Visible = False
Next cmt
End Sub

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=552913




All times are GMT +1. The time now is 12:54 AM.

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