图片居中命令




按alt+F11,插入-模块,然后在里面输入上面的代码,回到excel,选择你需要对齐图片的工作表,然后alt+F8执行宏“duiqi”就可以了。(以图片左上角所在单元格为对齐目标单元格,注意图片别放错格子)
Sub duiqi()
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


相关文档
最新文档