Drofidnas
Board Regular
- Joined
- Jun 30, 2004
- Messages
- 126
Hi
I've got some code that invokes the comment box for the selected cell when double clicked. The reason for this is I'm using right click to mark/umark cells.
I can get the comment to open but I'd like to focus the cursor in the box if possible and at the very least close the box when it is deselected.
Is this achievable?
Setting cmt.Visible to False just adds a comment with no option to edit.
Thanks for any help.
Chris
EDIT
Adding
closes all comment boxes so that seems to work, just the focusing part would be good
I've got some code that invokes the comment box for the selected cell when double clicked. The reason for this is I'm using right click to mark/umark cells.
I can get the comment to open but I'd like to focus the cursor in the box if possible and at the very least close the box when it is deselected.
Is this achievable?
Setting cmt.Visible to False just adds a comment with no option to edit.
Thanks for any help.
Chris
Code:
Private Sub Worksheet_Beforedoubleclick(ByVal Target As Range, Cancel As Boolean)
errTrap:
If Target.Column >= 4 Then
Cancel = True
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
Set cmt = ActiveCell.AddComment
cmt.Text Text:="Milestone date:" & vbLf
End If
cmt.Visible = True
End If
End Sub
EDIT
Adding
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.DisplayCommentIndicator = xlCommentIndicatorOnly
End Sub
closes all comment boxes so that seems to work, just the focusing part would be good
Last edited: