excel利用自定义函数提取单元格中的批注
时间:2023-12-06 16:51:00
用下面的自定义函数可以将某个单元格中的批注提取到其他单元格中,方法如下:
1.按Alt+F11打开VBA编辑器,单击菜单“插入→模块”,在“工程”窗口中会看到Excel插入了一个名称为“模块1”的模块。
2.在右侧“模块1”的代码窗口中输入下列代码:
Function GetComment(rCell As Range)
Application.Volatile ‘将自定义函数标记为易失性函数
Dim Cmt As String
On Error Resume Next
Cmt = rCell.Comment.Text
GetComment = Right(Cmt, Len(Cmt) – InStr(1, Cmt, ":", vbTextCompare))
On Error GoTo 0
End Function
3.关闭VBA编辑器,返回到Excel界面。假如要提取A10单元格中的批注,则在其他单元格中输入公式:
=GetComment(A10)
回车后即可得到A10单元格中的批注内容,注意本自定义函数仅提取批注内容,而不包含批注作者。由于将自定义函数标记为易失性函数,如果A10单元格中的批注被修改,按F9键或当任意单元格进行计算时即可得到修改后的批注内容。
标签:函数,单元格,批注,自定义,Excel函数
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
word怎么让文本框根据文字调整大小
2023-08-14 22:09:39
![](https://img.aspxhome.com/file/2023/5/31835_0s.jpg)
srvc32.exe - srvc32是什么进程
2023-06-14 22:43:18
SVN客户端:Cornerstone mac版的配置与使用
2022-04-08 14:09:45
![](https://img.aspxhome.com/file/2023/2/a212172_0s.png)
word一排两页怎么转换成一排一页
2023-11-29 18:52:42
![](https://img.aspxhome.com/file/2023/8/18708_0s.jpg)
猎豹浏览器怎么收藏网页?网页收藏方法简述
2022-10-06 09:46:28
![](https://img.aspxhome.com/file/2023/7/a331325_0s.jpg)
如何在WPS中删除带有页码的空白?
2022-09-27 00:29:22
使用Windows更新安装Win10打印机的技巧
2022-11-05 13:47:32
![](https://img.aspxhome.com/file/2023/4/a308743_0s.jpg)
在wps文字中如何设置字符底纹
2022-01-17 01:40:52
Win11提示损坏的映像错误代码0xc000012f怎么解决?
2023-06-12 11:14:49
![](https://img.aspxhome.com/file/2023/1/a275282_0s.jpg)
如何在Excel中快速显示隐藏的行
2023-03-15 21:40:40
![](https://img.aspxhome.com/file/2023/4/a156554_0s.jpg)
如何在WPS文字给引用文献加脚注
2023-08-16 03:57:53
现在Win7还能免费升级Win10吗?
2023-12-14 13:34:15
![](https://img.aspxhome.com/file/2023/26/a219326_0s.png)
适用于作家和开发人员的4种最佳Mac文件比较工具
2023-12-09 04:20:43
![](https://img.aspxhome.com/file/2023/9/a211029_0s.jpeg)
PowerPoint中平抛运动的实现图解教程
2022-11-19 06:03:29
![](https://img.aspxhome.com/file/2023/10/a344739_0s.jpg)
电脑硬盘检测出损坏问题怎么办?修复损坏硬盘的方法
2023-07-15 03:06:35
如何禁用windows 7系统键盘上的Power键
2023-07-15 17:42:57
![](https://img.aspxhome.com/file/2023/29/a259335_0s.png)
Win7/Win8免费升级Win10正式版提示除去小技巧
2023-11-08 22:39:23
![](https://img.aspxhome.com/file/2023/28/a249884_0s.jpg)
怎么制作不同比例的Excel面板图
2022-12-31 23:59:21
![](https://img.aspxhome.com/file/2023/0/a142410_0s.png)
Win7系统打印机显示脱机状态如何解决?
2022-12-23 19:37:09
![](https://img.aspxhome.com/file/2023/5/a315287_0s.jpg)
如何手动计算wps office工作表?
2023-07-04 16:41:45
![](https://img.aspxhome.com/file/2023/7/a167937_0s.gif)