① 怎么用公式提取Excel的批注内容
第1步: 按alt+f11键 ,可以打开visual basic窗口,这里就是编写自定义函数的地方。打开后执行插入 - 模块。模块是存放代码的具体位置
第2步:把下面的代码粘到右边的空白位置。
Function 提取批注(rg As Range) '定义函数名和参数
Application.Volatile True '定义该函数为易失性函数
提取批注 = rg.Comment.Text ’提取批注内容
End Function ’结果语句
执行以上两步,自定义函数设置完成,然后在工作表中就可以象其他EXCEL内置函数一样使用自定义函数了。
=提取批注(D7)
② 如何快速提取EXCEL表格中的批注
方式:
1、alt+f11,调出vbe编辑器;
2、双击工作表名称,粘贴如下代码:
sub
test1()
on
error
resume
next
for
each
cel
in
selection
if
not
cel.comment
is
nothing
then
i
=
i
+
1
cells(i,
1)
=
cel.comment.text
end
if
next
end
sub
3、按下f5,执行代码;
4、返回工作表,查看效果(批注已全部提取到a列)
③ Excel批量提取批注与删除批注
问题情境
如下样表:
④ excel中如何提取特定批注的数值
'自定义公式-按ALT+F11-插入模块-粘贴代码-将表格另存为启用宏的格式
Function 批注对应值(a As Range, b As String)
For Each cel In a
If InStr(cel.Comment.Text, b) Then 批注对应值 = cel.Value
Next
End Function