跳到主要内容

如何在Excel中更改注释指示器的颜色?

在Excel中,插入注释后,单元格的右上角会出现一个小的红色三角形指示器。 许多Excel用户可能会怀疑红色指示器的颜色是否可以更改为他们喜欢的其他颜色。 在本文中,我将讨论一种完成此任务的解决方法。

使用VBA代码更改注释指示器颜色


箭头蓝色右气泡 使用VBA代码更改注释指示器颜色

我们没有直接的方法可以快速,轻松地更改注释指示器的颜色,但是下面的VBA代码可以帮助您绘制一个三角形,使每个注释指示器与活动工作表上需要的特定颜色重叠。

1. 激活您要更改注释指示器颜色的工作表。

2。 按住 ALT + F11 键打开 Microsoft Visual Basic for Applications窗口.

3。 点击 插页 > 模块,然后将以下代码粘贴到 模块窗口.

VBA代码:更改活动工作表中的注释指示器颜色

Sub CoverCommentIndicator()
'Update 20141110
Dim pWs As Worksheet
Dim pComment As Comment
Dim pRng As Range
Dim pShape As Shape
Set pWs = Application.ActiveSheet
wShp = 6
hShp = 4
For Each pComment In pWs.Comments
  Set pRng = pComment.Parent
  Set pShape = pWs.Shapes.AddShape(msoShapeRightTriangle, pRng.Offset(0, 1).Left - wShp, pRng.Top, wShp, hShp)
  With pShape
    .Flip msoFlipVertical
    .Flip msoFlipHorizontal
    .Fill.ForeColor.SchemeColor = 12
    .Fill.Visible = msoTrue
    .Fill.Solid
    .Line.Visible = msoFalse
  End With
Next
End Sub

4。 粘贴代码后,按 F5 键执行代码,所有红色三角形指示器被蓝色三角形覆盖,如以下屏幕截图所示:

文档更改注释指示器-1
-1
文档更改注释指示器-2

笔记:

1.在上面的代码中,您只需更改脚本中的颜色索引即可将蓝色更改为您喜欢的颜色 .Fill.ForeColor.SchemeColor = 12.

2.当您调整单元格大小时,在VBA上方添加的三角形形状将更改其大小。

3.如果要立即删除所有彩色三角形,请按照以下VBA代码进行操作:

VBA代码:删除注释指示器上方的三角形

Sub RemoveIndicatorShapes()
'Update 20141110
Dim pWs As Worksheet
Dim pShape As Shape
Set pWs = Application.ActiveSheet
For Each pShape In pWs.Shapes
    If Not pShape.TopLeftCell.Comment Is Nothing Then
      If pShape.AutoShapeType = msoShapeRightTriangle Then
        pShape.Delete
      End If
    End If
Next
End Sub

相关文章:

如何在Excel中用注释突出显示所有单元格?

如何在Excel中显示或隐藏所有注释和注释指示符?

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (4)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
so useful, thanks...
This comment was minimized by the moderator on the site
tried the above to change the colour of the comment indicator but no luck? When selecting F5 to execute the code nothing happens? Help please, thansk
This comment was minimized by the moderator on the site
Bonjour peut on faire la meme chose sous condition (ex : si le commentaire contient un mot)?
This comment was minimized by the moderator on the site
Thanks for the idea!! Because I'm working in a VBA/macro free environment (security constraints), I just created a tiny little triangle shape and put it on top of all the bright red indicators, setting the properties to move but don't size with cells. Worked like a charm :-)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations