Excel VBA
Excel实现仿放大镜
2016-12-14 12:17:23

Excel实现仿放大镜功能。点击单元格,自动放大单元格的内容。

通过调整宏代码,可以设置单元格内容放大的倍数,放大的背景等。

作者:Excel小子-Office中国

 

Excel仿放大镜操作动画

 

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 = True

        End Sub

点击加入群:Excel部落 结识Excel大神
学好Excel,效率成倍提高,薪水稳步增长,职位快速提升每天一个源创技巧,如觉得有用,请点上面 关注。更重要手机转发分享

如喜欢此技巧,手机右上角点开,分享到QQ空间,方便自己以后看