怎样使用VBA返回单元格之批注
1、首先在开发工具中打开VBA编辑器
2、在单元格区域当中输入一些内容作为例子
3、在VBA编辑器中插入模块
4、在模块当中输入如下代码,然后运行Function Comment(rng As Range) '提取批注 Application.Volatile On Error GoTo err If rng.Count=1 Then '如果选择单个单元格 Comment=rng.Comment.Text '取出批注 Else '否则 Comment="只能选单个单元格" '返回提示 End If Exit Functionerr: Comment="" '当前单元格无批注时显示空白 End Function
5、在单元格B2中输入公式“=Comment(A2)”,则返回结果为空;若在单元格B3中输入公式“=Comment(A1:A3)”,则结果返回“只能选单个单元格”
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:85
阅读量:77
阅读量:85
阅读量:29
阅读量:23