【问题标题】:Is there a way to retrieve the cell address of a comment in Excel?有没有办法在 Excel 中检索评论的单元格地址?
【发布时间】:2013-11-03 06:12:41
【问题描述】:

我正在编写一个简短的宏来操作 Excel 中的一些 cmets。有一种方法可以在我的活动工作表中找出评论的单元格地址/位置会很有用 - 有没有办法用 Excel 中的评论对象来做到这一点?或者如果失败了,任何聪明的解决方法都会给我同样的结果?

我想要实现的一些说明性伪代码:

dim wb as Workbook
dim ws as worksheet
dim cmt as Comment

set wb = ActiveWorkbook

for each ws in wb.sheets
    for each cmt in ws.comments
        debug.print cmt.address ' Pseudo code
    next cmt
next ws

【问题讨论】:

    标签: vba excel


    【解决方案1】:

    试试:

    Dim wb As Workbook
    Dim ws As Worksheet
    Dim cmt As Comment
    
    Set wb = ActiveWorkbook
    
    For Each ws In wb.Sheets
        For Each cmt In ws.Comments
            'Debug.Print cmt.Address ' Pseudo code
            Debug.Print cmt.Parent.Address
        Next cmt
    Next ws
    

    关于信息:.parent 返回注释对象的父对象,在本例中为单元格。

    【讨论】:

    • 当然,cmt.Parent.Rowcmt.Parent.Column 会为您提供单独的行号和列号(例如,F 列为 6)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-24
    • 2021-04-16
    • 2015-12-11
    • 2016-01-10
    相关资源
    最近更新 更多