Search TeachExcel.com
TeachExcel.com
TE
Teach Excel MS Office Tutorials Excel Consulting Services Excel Forum
Excel Video Tutorials Excel Tips Free Excel Macros Excel Help Resources Contact TeachExcel
Video Tutorials
  • Free Macros
  • Excel Help Directory
  • Excel 2007 Resources
  • Keyboard Shortcuts
  • Excel Forum
  • Contact/About

Macros
Excel Tutorials For Macros

Get Text from Comments in Excel Including the Author of the Comment - UDF


Bookmark and Share

Output all text from a cell comment, including comment author, with this UDF in Excel. This UDF (user defined function) has only one argument and is very easy to use. Simply, point the range argument to a cell that contains a comment and then hit enter. This function in Excel will then return all of the text and the author's name from the comment. The author's name is just the default text that appears in bold before the text in a comment.

If you want a UDF for Excel that returns only the comment text, without the author, check out the other UDF on this website that does that.
Where to install the macro:  Module

UDF to Get Text from Comments in Excel Including the Author of the Comment

Function GETCOMMTEXTWITHAUTH(rCommentCell As Range)

Dim cmnt As String

On Error Resume Next

cmnt = WorksheetFunction.Clean(rCommentCell.Comment.Text)

GETCOMMTEXTWITHAUTH = cmnt

On Error GoTo 0

End Function


Bookmark and Share


How to Install the Macro
  1. Select and copy the text from within the grey box above.

  2. Open the Microsoft Excel file in which you would like the Macro to function.

  3. 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

  4. 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.

  5. If the Macro goes in a Module, Click Here, otherwise continue to Step 8.

    1. Go to the menu at the top of the window and click Insert > Module
    2. 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.
    3. Go to Step 8.

  6. If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.

    1. 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.
    2. Then, at the bottom of the list that appears, double-click the ThisWorkbook text.
    3. 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.
    4. Go to Step 8.

  7. If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.

    1. 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.
    2. 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.
    3. 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.
    4. 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.
    5. Go to Step 8.

  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.

  9. You are now ready to run the macro.



Similar Helpful Excel Resources

Excel Comments Replace Author - Excel

View Content
Is there a way to change Globally author in comments in Excel. ta


Changing Author Of Comments In Excel - Excel

View Content
I'm trying to change the author's name of all comments in a spreadsheet. In Excel 2000, when I rollover a comment, the status bar displays the name of the author (e.g., "Cell D4 Commented by NAME").

How can I change the author name for all existing comments in the spreadsheet?

Thanks.

Changing The Name Of The Cell Comments Author In Excel 2007 - Excel

View Content
test

Setting Author Of Comment? - Excel

View Content
Okay so after a bunch of searching all i found was this webpage

http://www.contextures.com/xlcomments03.html#Name


But it doesn't exactly help me do what i want to do.

Basically im using the

Code:

cells(1,1).addcomment "Comment"


but when you add a comment that way is does not set any kind of author. I have an inputbox which asks the user for the author name to input, i just want to see if anybody knows how to do that?


Or maybe i could just change
Code:

Application.UserName = "Author Name"


but when using the .addcomment it doesn't put the author name in there to begin with?


Thanks guys!

Changing Author Title In Comments Boxes - Excel

View Content
Hi

I have a series of comments boxes which start with an author's name then a colon and then the comment itself e.g. David Smith: annual report 06.

I would like to change "David Smith"'s name to mine globally, does anyone know how i could do that on a global basis

Thanks Simon

Retrieving Properties Of Any Files (author,comments Etc.) - Excel

View Content
Hi,
i would like to retrieve the properties of any type of files on the disc. On "properties" I mean the fields that i can reach with right-click on the file, Properties -> Summary -> Advanced : Title, Subject, Author, Category, Comments, etc.
I'd like to identify certain files without opening them, but by reading some properties.
Is it possible with tools of VBA? I couldn't find any proper solution. Everybody talk about properties of active workbooks or only xls.
I need some tool for file "management". The only restriction is that i would like it to use on a network that i have no admin rights so I cannot install any new components or plug-in. I can work only with standard VBA libraries etc.

Thanks for the answer.

Prevent Name Of Comment Author From Changing When Saving File - Excel

View Content
Hi,

I have and excel file, where you can find different comments inside cells, but whenever i click save (CTRL+S), my name changes to Author automatically.

I checked in:
File > Options > General > Username (it's my user pjeterd), but this is happening all the time i hit TRL+S.

I have Office 2010, please help!

Thanx in advance

Including Notes / Comments In Formula - Excel

View Content
I have a number of tediously long formulae with multiple IF statements. Despite using named ranges for elements within each formula, it is still not always clear what each IF statement is testing for (when I come back to it after 6 months).

Is there a way of adding comments or notes into a formula, without affecting its function? I know notes can be added at the end, but I'm after a way to include them after each IF condition.

Macro To Show Comments Including Cell Information - Excel

View Content
Hi all

I'm trying to add the comment to one cell showing the component of that cell, this is the worksheet I've made

Sheet1

Item Contract Amount(Jul)
1 aaa 55
2 bbb 66
3 ccc 77
4 ddd 88
5 eee 99


Sheet2
SubItem SubContract Amount(Jul)
1 aa1 11
1 aa2 44
2
3
3
4
5

Now, obviously contract 1.aaa of sheet1 is consist of SubContract aa1 and aa2 from sheet2, with the sum amount of 55 = 11 +44

What I want is to create a macro to insert a comment box into the cell with value 55 and showing the combination of that cell " aa1 $ 11, aa2 $ 44", and also for other cells in sheet1

Hope I explain myself clearly

your helps are much appreciated

Thanks a lot
Thomas

How To Highlight Only The New Comments Added In The Comment Box - Excel

View Content
Hi,

I have an excel sheet which has comment box where the users go in and add project comments on the relevant cells. I have created a macro which copies(exports) all these comments from the comment box to Word. I need a macro which will highlight only the latest comments which were added on the comment box when exported to Word. ( So all the new additions will be highlighted in word).Please refer to the macro which currently exist.

Cheers!

Public Sub CopyActiveCommentsToWord()
Sheets("Change Calendar").Unprotect "mi"
Dim cmt As String
Dim C As Range
Dim I As Integer
Dim WordObj As Object
Dim ws As Worksheet
Dim PrintValue As Boolean
Dim res As Integer
On Error Resume Next
Err.Number = 0
res = MsgBox("Do want to view comments in Word?", _
vbYesNoCancel + vbQuestion, "Print Cell Comments")
Select Case res
Case vbYes
PrintValue = True
Case Else
Exit Sub
End Select
Set WordObj = GetObject(, "Word.Application")
If Err.Number = 429 Then
Set WordObj = CreateObject("Word.Application")
Err.Number = 0
End If
WordObj.Visible = True
WordObj.Documents.Add
With WordObj.Selection
.TypeText Text:="All Cell Comments in Sheet: " + ActiveSheet.Name
.TypeParagraph
.TypeText Text:="Date: " & Format(Now(), "dd-mmm-yy hh:mm")
.TypeParagraph
.TypeParagraph
End With
For Each ws In Worksheets
If ws.Visible = xlSheetVisible Then
For I = 1 To ws.Comments.Count
Set C = ws.Comments(I).Parent
Select Case C.EntireRow.Hidden + C.EntireColumn.Hidden
Case 0
cmt = ws.Comments(I).Text
With WordObj.Selection
If PrintValue = True Then
.TypeText Text:="Cell String: " & CStr(C.Address(0, 0, xlA1))
.TypeParagraph
.TypeText Text:="Project Type: " & Format(C.Value)
.TypeParagraph
.TypeText Text:="Project Name: " & C.Offset(0, 1).Value
.TypeParagraph
.TypeText Text:="Project Owner: " & C.Offset(0, 2).Value
.TypeParagraph
.TypeText Text:="Project Description: " & C.Offset(0, 4).Value
.TypeParagraph
.TypeText Text:="Key Dates: " & C.Offset(0, 3).Value
.TypeParagraph
.TypeText Text:="Issues/Mitigants: " & C.Offset(0, 7).Value
End If
.TypeParagraph
.TypeText Text:=cmt
.TypeParagraph
.TypeParagraph
.TypeParagraph
End With
End Select
Set C = Nothing
Next I
End If
Next ws
Set WordObj = Nothing
MsgBox "Finished Printing Comments To Word", vbInformation, _
"PrintCellComments"
Sheets("Change Calendar").Protect "mi"
End Sub

Random Tutorials
Net Present Value / Discounted Cash Flow Calculations
(Intermediate)
Lookups With MATCH() and INDEX() Functions
(Intermediate)
HLOOKUP() Function - Introduction
(Intermediate)
AND(), OR(), and IF() Statements/Formulas
(Intermediate)
Consolidate & Combine Data from Separate Worksheets or Workbooks(Excel Files)
(Intermediate)
Assign Keyboard Shortcuts to Macros
(Easy)
Submit Inquiry Here
  • Prices From $10
Name:*
E-mail:*
Request:*
The macro(s) on this page will be sent with the request.
Contact | Privacy Policy | Disclaimer
Copyright© 2012 TeachExcel.com