OzGrid

Excel: Get Text From Excel Cell Comments

< Back to Search results

 Category: [Excel]  Demo Available 

Excel: Get Text From Excel Cell Comments

 

Got any Excel/VBA Questions? Free Excel Help

This UDF will extract the text from a cell comment

The Code

Function GetCommentText(rCommentCell As Range)

Dim strGotIt As String

    On Error Resume Next

    	strGotIt = WorksheetFunction.Clean _

              (rCommentCell.Comment.Text)

    		GetCommentText = strGotIt

    On Error GoTo 0

End Function

To use this UDF push Alt+F11 and go Insert>Module and paste in the code. Push Alt+Q and save. The Function will appear under "User Defined" in the Paste Function dialog box (Shift+F3). Use the Function in any cell as shown below. 

=GetCommentText(A1)
Where cell A1 has a cell comment. (Insert>Comment)

See also:

Excel Ranges: Finding the Last Cell in a Range
Excel: Get File Name From User to Open Workbook Or Save Workbook
Excel VBA Runtime Errors & Preventing Them
Sheet/Worksheet CodeNames
Automatically Run Excel Macros via Workbook & Worksheet Events
Excel: Password Protect/Unprotect All Excel Worksheets in One Go
Excluding Headings/Headers From the Current Region/Table

 

See also Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions.

 

Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


Gallery



stars (0 Reviews)