从 Excel 导出注释

发布于 2024-10-10 18:08:53 字数 35 浏览 2 评论 0原文

有没有办法从 Excel 工作表中导出注释以及单元格值?

Is there a way to export the comments from an excel sheet along with the cell value.?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

隱形的亼 2024-10-17 18:08:53

以下是返回工作表中所有注释的函数示例:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文