Forum Discussion

Noel_Sherry's avatar
Noel_Sherry
Copper Contributor
Jan 06, 2020

Extracting content from all cell notes on Excel sheet

I have used an Excel Sheet to record blood pressure readings for my health, and I have put a daily journal remark in a separate cell note for each day. I have hundreds of these notes, and I am trying to find an automated way to extract the content in each note (in order) so I do not have to open, copy, and paste each note's content individually. Can this be done?

  • peterbubsirii's avatar
    peterbubsirii
    Copper Contributor
    For anyone still trying to solve this:

    UDF (user defined function) is a way to make a VBA script work like any other Excel formula
    so as pointed out below
    '-----------------------------------------------
    Function CellNote(cell As Range) As String
    CellNote = cell.Comment.Text
    End Function
    '---------------------------------------
    creates a new function in Excel you can use to get the value of the "note"
    To implement just copy the little snippet of code above, then (in excel) hit alt-F11 to bring up the macro/VB window, click Insert, Module paste the text, close the window and you can now type in =cellnote(A12) or whatever cell you're interested in and have the text waiting for you
    There's no error trapping so if there's no note/comment you get the VALUE! error
    When you save your excel file you will need to "save as" .xlms" otherwise you'll have to reenter the function every time!!! (this is true for the other VBA code examples)

    UDFs don't update on all excel updates - but ctrl-alt-F9 does the trick!

Resources