且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用VBA向单元格添加评论

更新时间:2023-12-04 10:00:52

将鼠标悬停在包含注释的任何单元格上,显示该单元格的注释

hovering over any cell, that contains a comment, shows that cell's comment

这是向单元格添加评论以及更新评论文本的方式

this is how you add a comment to a cell and how you update the comment text

Sub aaa()
    With Range("E6")
        If Not .Comment Is Nothing Then .Comment.Delete
        .AddComment "this is a comment"
        .Comment.Text "abc123" 'No need the assignment sign "=" after .Comment.Text             
    End With
End Sub