In this article, you will learn how to create a UDF to Fetch Comment Text in Excel Cell VBA to get the comment text from an Excel Cell. Let’s say we have attendance data on the Excel sheet and We are putting comments for the absent employees. Now if we need to fetch these comments in Excel cell to do some analysis then we can use this UDF.
UDF to Fetch Comment Text in Excel Cell
Below is the code for this User-defined function.
Option Explicit Function Get_Comments(rng As Range) As String Application.Volatile Get_Comments = rng.Comment.Text 'Remove user name If InStr(Get_Comments, ":" & Chr(10)) > 0 Then Get_Comments = Right(Get_Comments, Len(Get_Comments) - VBA.InStr(Get_Comments, ":" & Chr(10)) - 1) End If End Function
Click here to download the Practice file-
Watch the step by step video tutorial:
Visit our YouTube channel to learn step-by-step video tutorials