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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,881
Office Version
  1. 2010
Platform
  1. Windows
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

mark hansen

Well-known Member
Joined
Mar 6, 2006
Messages
534
Office Version
  1. 2016
Platform
  1. Windows
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

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,902
Office Version
  1. 365
Platform
  1. Windows
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

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,881
Office Version
  1. 2010
Platform
  1. Windows
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,190,677
Messages
5,982,216
Members
439,769
Latest member
trungminh2802

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
Top