Sub 图片自适应()
Dim sh As Shape
For Each sh In ActiveSheet.Shapes
sh.LockAspectRatio = False
sh.Left = sh.TopLeftCell.Left
sh.Top = sh.TopLeftCell.Top
sh.Width = sh.TopLeftCell.Width
sh.Height = sh.TopLeftCell.Height
Next sh
End Sub
-----------------------------------------
打开excel,alt+F11打开宏,插入模块,将虚线上方内容粘贴进去。然后运行。
效果如下
Dim sh As Shape
For Each sh In ActiveSheet.Shapes
sh.LockAspectRatio = False
sh.Left = sh.TopLeftCell.Left
sh.Top = sh.TopLeftCell.Top
sh.Width = sh.TopLeftCell.Width
sh.Height = sh.TopLeftCell.Height
Next sh
End Sub
-----------------------------------------
打开excel,alt+F11打开宏,插入模块,将虚线上方内容粘贴进去。然后运行。
效果如下