VBA Code: Resize and Reposition Images in Excel Worksheet
Sub ResizeAndRepositionImages() Dim sh As Shape On Error Resume Next For Each sh In ActiveSheet.Shapes If sh.TopLeftCell.Address = "$L$9" Or _ sh.TopLeftCell.Address = "$L$10" Or _ sh.TopLeftCell.Address = "$L$11" Or _ sh.TopLeftCell.Address = "$L$12" Or _ sh.TopLeftCell.Address = "$L$13" Or _ sh.TopLeftCell.Address = "$L$14" Or _ sh.TopLeftCell.Address = "$L$15" Or _ sh.TopLeftCell.Address = "$L$16" Then sh.LockAspectRatio = msoFalse sh.Height = 87.874015748 sh.Width = 87.874015748 sh.Left = sh.TopLeftCell.Left + (sh.TopLeftCell.Width - sh.Width) / 2 sh.Top = sh.TopLeftCell.Top + (sh.TopLeftCell.Height - sh.Height) / 2 End If Next sh End Sub
原文地址: https://www.cveoy.top/t/topic/mAD8 著作权归作者所有。请勿转载和采集!