本文介绍了从Excel导出注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
这里有一个方法可以从excel表中导出注释以及单元格值。返回表格中所有注释的函数的示例:
Sub CreateCommentsSummary()
Dim rgComments As Range,rgCell作为范围,rgOutput As Range
'获取所有单元格的注释
设置rgComments = ActiveSheet.Cells.SpecialCells(xlCellTypeComments)
'获取单元格引用,用户想要放置总结
设置rgOutput = _
Application.InputBox(提示:=选择要放置评论摘要的单元格,_
标题:=注释摘要,类型:= 8)
'读取每个单元格注释并构建总结
对于每个rgCell在rgComments
rgOutput.Range(A1)= rgCell.Address'打印单元格地址
rgOutput.Offset(0,1).Range(A1)= rgCell.Value'打印单元格值
rgOut put.Offset(0,2).Range(A1)= rgCell.comment.Text'打印单元格注释文本
设置rgOutput = rgOutput.Offset(1,0)
下一个rgCell
End Sub
Is there a way to export the comments from an excel sheet along with the cell value.?
解决方案
Here is an example of a function that returns all comments in a sheet:
Sub CreateCommentsSummary()
Dim rgComments As Range, rgCell As Range, rgOutput As Range
' get all cells with comment
Set rgComments = ActiveSheet.Cells.SpecialCells(xlCellTypeComments)
' get cell reference where user want to place the summary
Set rgOutput = _
Application.InputBox(Prompt:="Select cell where you want to put the comments summary", _
Title:="Comments Summary", Type:=8)
' read each cell with comment and build the summary
For Each rgCell In rgComments
rgOutput.Range("A1") = rgCell.Address ' print cell address
rgOutput.Offset(0, 1).Range("A1") = rgCell.Value ' print cell value
rgOutput.Offset(0, 2).Range("A1") = rgCell.comment.Text 'print cell comment text
Set rgOutput = rgOutput.Offset(1, 0)
Next rgCell
End Sub
这篇关于从Excel导出注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!