

Excel VBA
【Ysh自定义函数】获取批注中的内容
2017-07-15 17:23:37
近来发现有些网友喜欢把内容放在批注。久而久之发现批注太多,处理很不方便,于是到处寻求把批注提取出来的办法。感觉这个需求弄成一个自定义函数挺实用的,如下图:
这个自定义函数代码比较简单
'函数名:获取批注的作者 '返回值:字符串(String) '--参数:rng,单元格,必填 '--示例:=GetCommentAuthor(A1) Public Function GetCommentAuthor(rng As Range) As String If Not rng.Comment Is Nothing Then GetCommentAuthor = rng.Comment.Author End Function '函数名:获取批注的内容 '返回值:字符串(String) '--参数:rng,单元格,必填 '--示例:=GetCommentText(A1) Public Function GetCommentText(rng As Range) As String If Not rng.Comment Is Nothing Then GetCommentText = rng.Comment.Text End Function
建议不要把数据放在批注,少用批注