|
Show a Single Comment in Excel - Means the Comment is Always Visible, No Hovering Necessary
This macro in Excel allows you to display or show a particular comment in Excel. This will make the desired comment visible even when you are not hovering over the cell that contains the comment. This is a great macro to use to display certain important comments throughout a worksheet or workbook in Excel.
To use the macro simply replace the A1 range cell reference with a reference to the location of the cell that contains the comment which you want to display.
Where to install the macro: Module
Excel Macro to Show a Single Comment in Excel - Means the Comment is Always Visible, No Hovering Necessary
Sub Display_Single_Comment()
'This macro displays a single comment that is in Excel - means you don't have to hover over it to read it
Range("A1").Comment.Visible = True
End Sub
How to Install the Macro
- Select and copy the text from within the grey box above.
- Open the Microsoft Excel file in which you would like the Macro to function.
- Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.
Or For other ways to get there, Click Here.
For Excel Versions Prior to Excel 2007 Go to Tools > Macros > Visual Basic Editor
For Excel 2007 Go to Office Button > Excel Options > Popular > Click Show Developer tab in the Ribbon. Then go to the Developer tab on the ribbon menu and on the far left Click Visual Basic
- On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.
- If the Macro goes in a Module, Click Here, otherwise continue to Step 8.
- Go to the menu at the top of the window and click Insert > Module
- Another window should have opened within the Visual Basic Editor's window. Within this new window, paste the macro code. Make sure to paste the code underneath the last line of anything else that is in the window.
- Go to Step 8.
- If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Then, at the bottom of the list that appears, double-click the ThisWorkbook text.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Go to Step 8.
- If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Within the list that appears you will see every worksheet that is in that excel file. They will be listed as such: Sheet1(NAME OF SHEET HERE) and under that will be Sheet2(NAME OF SHEET HERE). Select the sheet in which you want the macro to run and double-click that sheet.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Repeat steps b and c for every sheet you want the macro to work in. Putting the macro in one sheet will not enable it for any other sheets in the workbook.
- Go to Step 8.
- Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.
- You are now ready to run the macro.
Similar Helpful Excel Resources
Is there a way to have a comment, that is hidden, show when you hover over a locked cell (can't be selected) in a protected sheet? The cell is a Header that uses Autofilter.
When setting it up, unprotected sheet, the comment shows when I hover over the cell. But when I protect the sheet, I have to hit 'Ctrl' to get the comment to show. This is fine for me, but there are other users at various levels that may not know how to do that.
On another sheet it works fine, but I'm not using the Auto filter with those.
Any ideas? I'm using Excel 2003.
I would appreciate it if I could get a macro to do all 3 of the following.
I've found a macro to insert a comment... but I would also like to change the font and show the comment.
In an Excel doc, one worksheet out of many is afflicted with the following
problem: I can not edit any comments without first having to click on Show
Comments. I make the change and then have to click on Hide Comment. On all
the other worksheets you can go straight to Edit Comment. We keep a lot of
info in our comments and it has made more of a hassle.
Hello
I would like to Insert the contents of a Range of Cells into a single Comment. ie:
The contents of Range A1:A50 into a Comment placed at F1. Is there a Macro that will do this? Thanks All
I'm constantly jumping in and out of comments in Excel. Since I use the keyboard as much as possible to be efficient, I am always looking to reduce my need for the mouse.
Thus I'm developing a little way to be able to modify comments without having to use the mouse (normally I need to right click the ActiveCell in order to choose "Show/Hide comments"). Below is 2 simple lines of code for unhiding the comment of the ActiveCell and then selecting it. What I can't figure out how to do is actually get the cursor to be inside the comment so that I can start modifying text or entering additional text.
Here is my code:
Code:
Sub comment_unhide()
ActiveCell.Comment.Visible = True
ActiveCell.Comment.Shape.Select True
End Sub
Any ideas for how I can use VBA to emulate the next step of actually clicking on the comment so that the cursor goes inside the comment? Would SendKeys be a possibility?Thank you very much in advance.
Jared
I've been stumped a while on this - hopefully someone can help
I have a workbook where when I double-click on a cell, a pop-up box will appear allowing me to add a comment to the cell. This new comment would be added to whatever comments were already in that cell. In addition, the date, time, Excel registration name, etc. are all appended to the new comment (this function serves as a way to keep track of things). The following are the main issues I have along with a description:
Issue 1: I am having an issue where if I make any edits to a comment (right click the cell and edit comment) and apply new formatting (bolding, underlining, etc.), all this comment formatting is lost after I input a new comment (by double-clicking the cell and entering the new comment). Basically, I could have spent a few hours applying strike-through, bold, italics, etc. to comments only to have my work lost when a new comment is entered (all the comment text defaults back to regular text formatting).
Issue 2: When I want to edit a comment, I can not type directly into the comment to make any changes. Thus, the traditional way of right clicking a commented cell and hitting the "edit comment" button does not provide too much functionality. To delete things, I have to highlight the comment text and cut it and to type things in I type the comments I wish to addd in Notepad and then copy and paste the text into the comment. This is a very round-about way to make edits, but it is the only way I know how with the macro we are using.
The code that is built into the workbook is shown below this message. Hopefully, if someone knows the answer to this (I will be eternally grateful as the above issues have made it quite inconvenient to use the workbook), any suggestions on how to revise the code would be extremely helpful, as I am not a programmer in any way, shape, or form.
Thank you!
Jen
VB:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
On Error Resume Next
Dim cmtText As String
Dim strCommentName As String
Dim inputText As String
Const maxLineLength As Long = 65
Dim NoMore As Boolean
Dim Pos As Long
Dim i As Integer
Dim text As String
If Target.Comment Is Nothing Then
cmtText = InputBox("Please enter Comment:", "Comment Text")
If cmtText = "" Then Exit Sub
cmtText = Now & "-" & Application.UserName & "-" & cmtText
cmtText = Word_Wrap(cmtText, maxLineLength)
strCommentName = cmtText & vbLf & Now
Target.AddComment text:=cmtText
'Target.Comment.Visible = True
Target.Comment.Shape.TextFrame.AutoSize = True 'Remove if you want to size it yourself
Else
If Target.Comment.text <> "" Then
inputText = InputBox("Please enter Comment:", "Comment Text")
If inputText = "" Then Exit Sub
inputText = Now & "-" & Application.UserName & "-" & inputText
inputText = Word_Wrap(inputText, maxLineLength)
cmtText = Target.Comment.text & Chr(10) & inputText
Else
cmtText = InputBox("Please enter Comment:", "Comment Text")
End If
Target.ClearComments
cmtText = cmtText
Target.AddComment text:=cmtText
' Target.Comment.Visible = True
Target.Comment.Shape.Width = 300
Target.Comment.Shape.Height = 4000
'Remove if you want to size it yourself
End If
'Now copy the comment to the Other cell "Next Due Date"
Dim Col As Integer, Row As Integer
Row = Target.Row
Col = Target.Column
' 'Call function to format cell
If Not Target Is Nothing Then
FormatCellTemplateSheet Row, Col
End If
Cancel = True 'Remove this if you want to enter text in the cell after you add the comment
End Sub
If you like these VB formatting tags please consider sponsoring me in support of injured Royal Marines
I have a problem with a worksheet I've used for many years. Although I recently switched to Excel 2007, this had started to occur a while ago, with Excel 2000.
If I hover on a cell containing a comment, the comment correctly appears next to the cell. But if I right-click and pick Edit Comment, the following happens: screenshot
A rectangular group of cells becomes entirely blank, except for red and green triangles.
The top-right cell in the blanked area flashes slowly.
The comment is nowhere to be seen, and cannot be accessed even if I right-click in the area where it would appear.
I have been unable to find a solution to this problem. Thanks for your help.
Is there anyway i can use the deletion of a comment, or multiple comments, to activate a macro which will record them on another worksheet?
I already have a macro that lists current comments onto another worksheet, but i need to list and save comments when they are deleted.
Hi there.
I found some code that copies a comment box into another cell as text
Function MyComment(rng As Range)
Application.Volatile
Dim str As String
str = Trim(rng.Comment.Text)
'// If you want to remove Chr(10) character from string, then
str = Application.Substitute(str, vbLf, " ")
MyComment = str
End Function
But I really want to copy a comment box into another cell as a comment box, not just as text. Even better, I want to copy both text and comment from a source cell into a destination cell.
Can anyone tell me how to modify this accordingly?
I know I can do this by simply cutting the source box, and pasting it into the destination cell, but this will get pretty tedious given I have a zillion cells to deal with.
So what I want to do is say have a custom formula...say "=comment(name_ref)" that will point to whatever cell corresponds to name_ref, and then reads the text in the cell and the comment box from that cell and copies both of these to the cell that the formula is entered into.
This will also mean that the comment information isn't hardwired into a zillion different cells on the spreadsheet...i only need to update the master comments box once, and every other cell pointing to it will be updated.
Thanks for any help or pointers. I am new to macros, so try to keep anything you post as simple as possible.
Is it possible have a word document or multi paged pdf diplay by inserting a comment? Is there a better way to do this. I would like to have reports show when moused over.
|
|