Open a cell comment for editing

mark hansen

Well-known Member
Joined
Mar 6, 2006
Messages
534
Office Version
  1. 2016
Platform
  1. Windows
I have a process where I need the user to enter information into a cell, then add a comment. I can add a comment with default text, but the user needs to change the default comments every time.

I use the following to add the comment:

ActiveCell.AddComment
ActiveCell.Comment.Visible = False
ActiveCell.Comment.Text Text:="Default text" & Chr(10) & ""

What I would like to do is, using VBA right click on the Cell and select "Edit comment"

I tried something silly as ActiveCell.Comment.Edit, but of course that doesn't work

Can this be done, or should I settle on the users needing to right click in the cell and select "Edit Comment"?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
What happens if you do this?

Code:
[COLOR=#333333]ActiveCell.AddComment[/COLOR]
[COLOR=#333333]ActiveCell.Comment.Text Text:="Default text" & Chr(10) & ""
[/COLOR][COLOR=#333333]ActiveCell.Comment.Visible = True[/COLOR]
 
Upvote 0
Thanks for the help yky and Matt.

Making the comment visible (TRUE) will display it, but it remains up after editing. Thanks for the tip about double clicking. I found the SendKeys "+{F2}" options and it will work. I like to stay away from SendKeys when I can, but can't find anything else.

Thanks for help.
Mark
 
Upvote 0
Hi, how about using an input box to capture the default comment text - for example:

Code:
Dim s As String
s = InputBox("Enter your default text..")
ActiveCell.AddComment
ActiveCell.Comment.Visible = False
ActiveCell.Comment.Text Text:=s & Chr(10) & ""
 
Upvote 0
Making the comment visible (TRUE) will display it, but it remains up after editing.

Then, put "ActiveCell.Comment.Visible = False" in a Worksheet event such as SelectionChange or BeforeDoubleClick.
 
Upvote 0

Forum statistics

Threads
1,214,789
Messages
6,121,605
Members
449,038
Latest member
Arbind kumar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top