Excel VBA 根据合并单元格大小调整图片大小

来源:互联网 发布:c语言读取多个字符串 编辑:程序博客网 时间:2024/06/15 15:28
Sub adjustpic()  '根据合并单元格大小调整图片大小
Dim Pic As Shape
For Each Pic In ActiveSheet.Shapes
   If Pic.TopLeftCell.MergeCells = True Then
        Set cc = Pic.TopLeftCell.MergeArea
        Pic.LockAspectRatio = msoFalse
        Pic.Top = cc.Top + 5
        Pic.Left = cc.Left + 5
        Pic.Height = cc.Height - 10
        Pic.Width = cc.Width - 10
    End If
Next
End Sub
原创粉丝点击