使用VBA向单元格添加评论 [英] Add comments to cells using VBA

查看:339
本文介绍了使用VBA向单元格添加评论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以通过将鼠标悬停在某个单元格上来激活该单元格上的评论?我有一系列的单元格,当悬停在每个单元格上方时,我想从另一张工作表中提取相应的注释.悬停事件会将评论从另一张工作表中的相应单元格中拉出.

Is there a way to activate a comment on a cell by hovering over it? I have a range of cells that I would like to pull respective comments from another sheet when hovered over each individual cell. The hover event would pull the comments from their respective cells in the other sheet.

注释具有字符串值.基本上,我在工作表1中有一个单元格区域,假设是A1:A5,当我将它们悬停在工作表2并从工作表2范围B1:B5中拉出时,需要弹出注释.我之所以不手动进行操作,是因为工作表2的内容每天都在变化.这就是为什么我试图查看是否有VBA解决方案.

The comments are of string value. Basically, I have a range of cells in Sheet 1, let's say A1:A5 and I need comments to pop-up when I hover over them and pull from Sheet 2 range B1:B5. The reason why I won't do it manually is because the contents of Sheet 2 change every day. That is why I am trying to see if there is a VBA solution.

推荐答案

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

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

这篇关于使用VBA向单元格添加评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆