Hi,
This seems like it should be easy, but I'm struggling with it. I'm trying to make a function which will return a comment from a specified cell, or a null string if the cell doesn't have a comment. I wrote this, and it returns the actual comment fine, but it's returning a #VALUE error instead of the desired null string when applied to a non-commented cell:
I know that I can use "IfError" on worksheets, but I need this to work inside another sub. So it needs to return the blank string.![]()
Function GetComment(CommentedCell As Range) As String If IsError(CommentedCell.Comment.Text) = True Then GetComment = vbNullString Else GetComment = CommentedCell.Comment.Text End If End Function
Thanks a lot for reading!
Bookmarks