Public Function getComment(rng As Range) '自定义函数,带一个参数,参数指向批注所在的单元格 On Error GoTo Line getComment = rng.Comment.Text '如果单元格中有插入批注,则函数返回批注的内容 Exit Function Line: getComment = "" '如果单元格中没有插入批注,前面语句会报错,然后指向此行代码执行,函数返回空值 End Function
Public Function getComment(rng As Range) '自定义函数,带一个参数,参数指向批注所在的单元格 On Error GoTo Line getComment = rng.Comment.Text '如果单元格中有插入批注,则函数返回批注的内容 Exit Function Line: getComment = "" '如果单元格中没有插入批注,前面语句会报错,然后指向此行代码执行,函数返回空值 End Function
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。