【Excel】批量修改批注的大小位置等等
![]() |
http://site.douban.com/191976/ |
当鼠标悬停在单元格上时,批注应自动显示。而我的excel单元格批注显示为一条线,如何能将全部批注统一调整为正常状态?
一般造成这个原因是:批注格式属性设置问题。
选中批注边框,右键菜单,设置批注格式:
当你选择第一项,批注所在单元格行或列中途删除,就会压成一条线。
换为第三项“大小位置均固定”就好了
那么,怎么批量调整这些已经变成了黑线的批注呢?
用VBA了。
1,ALT+F11,插入,模块,把下面代码复制到模块1里
Sub 统一批注格式()
Dim biao As Worksheet
For i = 1 To ActiveSheet.Comments.Count
' ActiveSheet.Comments(i).Text i & "、透明批注" '指定所有批注的内容(包括批注编号)
ActiveSheet.Comments(i).Shape.Fill.Visible = msoFalse '设置批注透明
ActiveSheet.Comments(i).Shape.TextFrame.AutoSize = True '调整批注大小
ActiveSheet.Comments(i).Shape.Height = 30 '批注高度
ActiveSheet.Comments(i).Shape.Width = 50 '批注宽度
ActiveSheet.Comments(i).Shape.Fill.ForeColor.SchemeColor = 52 '批注底色
' ActiveSheet.Comments(i).Shape.Fill.Transparency = 0.3 '底色透明度
ActiveSheet.Comments(i).Shape.Line.Weight = 0.25 '边框线宽
ActiveSheet.Comments(i).Shape.Line.ForeColor.SchemeColor = 12 '边框颜色
ActiveSheet.Comments(i).Shape.Line.Transparency = 0.4 '边框透明度
ActiveSheet.Comments(i).Shape.Shadow.ForeColor.RGB = RGB(0, 20, 150) '阴影颜色
ActiveSheet.Comments(i).Shape.Shadow.Transparency = 0.4 '阴影透明度
ActiveSheet.Comments(i).Shape.Shadow.OffsetX = 5.5 '横向阴影大小
ActiveSheet.Comments(i).Shape.Shadow.OffsetY = 3.5 '纵向阴影大小
ActiveSheet.Comments(i).Shape.TextFrame.Characters.Font.Size = 10 '字号
ActiveSheet.Comments(i).Shape.TextFrame.Characters.Font.Bold = True '字体
ActiveSheet.Comments(i).Shape.Visible = False '隐藏批注
Next
End Sub
2,关闭代码窗口,ALT+F8,执行宏“统一批注格式”
不过上述代码里并不是每句都是要的,其实只要用这段简单的代码就可以了。
Sub 统一批注格式()
Dim biao As Worksheet
For i = 1 To ActiveSheet.Comments.Count
ActiveSheet.Comments(i).Shape.TextFrame.AutoSize = True '调整批注大小
ActiveSheet.Comments(i).Shape.Height = 30 '批注高度
ActiveSheet.Comments(i).Shape.Width = 50 '批注宽度
ActiveSheet.Comments(i).Shape.Visible = False '隐藏批注
Next
End Sub
▓史上最轻松的PPT教程http://www.douban.com/doulist/38846619/
▓网友众选的热门游戏排行榜Top100
http://www.douban.com/doulist/38843183/
♀更多精品:http://site.douban.com/191976/
♂分享者:http://www.douban.com/group/yaoqingzhuce/
还没人转发这篇日记