Office中国论坛/Access中国论坛

标题: 【Ysh自定义函数】获取批注中的内容 [打印本页]

作者: 盗梦    时间: 2015-1-23 14:36
标题: 【Ysh自定义函数】获取批注中的内容
本帖最后由 盗梦 于 2015-1-23 14:41 编辑

近来发现有些网友喜欢把内容放在批注。久而久之发现批注太多,处理很不方便,于是到处寻求把批注提取出来的办法。感觉这个需求弄成一个自定义函数挺实用的,如下图:
[attach]55512[/attach]
这个自定义函数代码比较简单
  1. '函数名:获取批注的作者
  2. '返回值:字符串(String)
  3. '--参数:rng,单元格,必填
  4. '--示例:=GetCommentAuthor(A1)
  5. Public Function GetCommentAuthor(rng As Range) As String
  6.     If Not rng.Comment Is Nothing Then GetCommentAuthor = rng.Comment.Author
  7. End Function

  8. '函数名:获取批注的内容
  9. '返回值:字符串(String)
  10. '--参数:rng,单元格,必填
  11. '--示例:=GetCommentText(A1)
  12. Public Function GetCommentText(rng As Range) As String
  13.     If Not rng.Comment Is Nothing Then GetCommentText = rng.Comment.Text
  14. End Function
复制代码
建议不要把数据放在批注,少用批注
[attach]55513[/attach]


作者: xiaowuo2    时间: 2015-1-23 15:23
感谢分享,顶你
作者: 盗梦    时间: 2015-1-23 15:24
xiaowuo2 发表于 2015-1-23 15:23
感谢分享,顶你






欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3