ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 535|回复: 4

[求助] 修改批注

[复制链接]

TA的精华主题

TA的得分主题

发表于 2022-12-31 02:24 | 显示全部楼层 |阅读模式
本帖最后由 cz_jie 于 2022-12-31 02:25 编辑

如何用VBA来批量修改批注指定字符(颜色、大小、粗细字符在内容中突显出来




请求老师们赐与代码

在此谢了


a6193ba4e93c245060c4333f765bf8d.png

表格.zip

29.22 KB, 下载次数: 6

TA的精华主题

TA的得分主题

发表于 2022-12-31 09:50 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助

Sub changecommentshapetype()
Dim com As Range
On Error Resume Next
For Each com In Range("A1:H25")
com.Select
With com.Comment
    .Visible = True '是否可见
    .Shape.AutoShapeType = msoShapeRoundedRectangle '外框图形
    .Shape.Fill.UserPicture ThisWorkbook.Path & "\123.jpg"
    .Shape.Placement = xlMoveAndSize '属性
    .Text Text:="Excel Home:" '文字
    .Shape.Fill.Transparency = 0#
    .Shape.Line.Weight = 1#
    .Shape.Line.DashStyle = msoLineSquareDot
    .Shape.Line.Style = msoLineSingle
    .Shape.Line.Transparency = 0#
    .Shape.Line.Visible = msoTrue
    .Shape.Line.ForeColor.SchemeColor = 17
    .Shape.Line.BackColor.RGB = RGB(255, 255, 255)
    .Shape.Fill.Visible = msoTrue
    .Shape.Fill.ForeColor.RGB = RGB(255, 255, 225)
    .Shape.Fill.BackColor.RGB = RGB(255, 255, 225)
    .Shape.LockAspectRatio = msoFalse
    .Shape.Height = 113.25
    .Shape.Width = 141.75
    .Shape.Rotation = 0#
End With
Next
End Sub

评分

1

查看全部评分

TA的精华主题

TA的得分主题

发表于 2022-12-31 10:28 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
批注的例子:
2022-12-31批注.png

评分

1

查看全部评分

TA的精华主题

TA的得分主题

发表于 2022-12-31 11:10 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
Sub HasComment()
With Sheet1
    ar = .[a1].CurrentRegion
    For i = 3 To UBound(ar)
        For j = 1 To UBound(ar, 2)
            If Not .Cells(i, j).Comment Is Nothing Then
                With .Cells(i, j).Comment
                    If InStr(.Text, "有") > 0 Then
                        ks = InStr(.Text, "有")
                        .Shape.TextFrame.Characters(ks, 1).Font.Color = RGB(255, 97, 3)   '设置字体颜色
                        .Shape.TextFrame.Characters(ks, 1).Font.Bold = True  '设置加粗
                    End If
                    If InStr(.Text, "【") > 0 Then
                        ks = InStr(.Text, "【")
                        .Shape.TextFrame.Characters(ks, 1).Font.Color = vbRed ' RGB(255, 97, 3)  '设置字体颜色
                        .Shape.TextFrame.Characters(ks, 1).Font.Bold = True  '设置加粗
                    End If
                    If InStr(.Text, "】") > 0 Then
                        ks = InStr(.Text, "】")
                        .Shape.TextFrame.Characters(ks, 1).Font.Color = vbRed ' RGB(255, 97, 3)  '设置字体颜色
                        .Shape.TextFrame.Characters(ks, 1).Font.Bold = True  '设置加粗
                    End If
                    If InStr(.Text, "冰箱") > 0 Then
                        ks = InStr(.Text, "冰箱")
                        .Shape.TextFrame.Characters(ks, 2).Font.ColorIndex = 7 ' RGB(255, 97, 3)  '设置字体颜色
                        .Shape.TextFrame.Characters(ks, 2).Font.Bold = True  '设置加粗
                    End If
                End With
            End If
        Next j
    Next i
End With
MsgBox "ok!"
End Sub

TA的精华主题

TA的得分主题

发表于 2022-12-31 11:11 | 显示全部楼层
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-6-16 19:29 , Processed in 0.044171 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表