excel单元格图片居中
作者:互联网
1.单元格内图片
Sub dq() Dim shp As Shape For Each shp In ActiveSheet.Shapes shp.Left = (shp.TopLeftCell.Width - shp.Width) / 2 + shp.TopLeftCell.Left shp.Top = (shp.TopLeftCell.Height - shp.Height) / 2 + shp.TopLeftCell.Top Next End Sub
2.合并单元格内图片
Sub dq() Dim shp As Shape For Each shp In ActiveSheet.Shapes Set picArea = shp.TopLeftCell.MergeArea shp.LockAspectRatio = False shp.Top = shp.Top shp.Left = shp.Left shp.Height = picArea.Height - 10 shp.Width = picArea.Width - 10 Next End Sub
标签:居中,shp,Sub,Top,单元格,excel,TopLeftCell,Width,Left 来源: https://www.cnblogs.com/zhouxg72/p/15983563.html