人气 3479

Excel实现仿放大镜 [复制链接]

戒烟三天半 2016-12-14 12:17:23
Excel实现仿放大镜功能。点击单元格,自动放大单元格的内容。通过调整宏代码,可以设置单元格内容放大的倍数,放大的背景等。
作者:Excel小子-Office中国

1481691268652318.jpg

1481691268652318.jpg

Excel仿放大镜操作动画

1481689162676115.gif

1481689162676115.gif

Excel仿放大镜详细VBA代码:Private Sub Worksheet_SelectionChange(ByVal Target As Range)  Dim a As Shape  x = Target(1).Row  y = Target(1).Column  If boo = False Then    ActiveSheet.Shapes.AddShape(msoShapeRoundedRectangle, Target.Top, Target.Left + Target.Width + 20, 250, 130).Select    Selection.Name = "MyLabel"  End If  ActiveSheet.Shapes("MyLabel").Select  Selection.Formula = Target.Address  Selection.Font.Size = Target(1).Font.Size + 30  Selection.Top = Target.Top - 30  Selection.Left = Target.Left + Target.Width + 20  Selection.ShapeRange.Line.Visible = msoFalse  With Selection.ShapeRange.Fill    .Visible = msoTrue    .ForeColor.ObjectThemeColor = msoThemeColorBackground1    .ForeColor.TintAndShade = 0    .ForeColor.Brightness = 0    .Transparency = 0    .Solid  End With  Target.Select  boo = TrueEnd Sub
您需要登录后才可以回帖 登录 | 立即注册

QQ|手机版|精益人 ( 沪ICP备19004111号-1 )

GMT+8, 2024-6-3 01:38 , Processed in 0.242211 second(s), 22 queries .

Powered by Lean.ren X3.5 Licensed  © 2001-2030 LEAN.REN