Sub nnnDim sh As ShapeOn Error Resume NextFor Each sh In ActiveSheetShapesshLockAspectRatio = msoFalseIf shTopLeftCellAddress = $L$9 ThenshHeight = 87874015748shWidth = 87874015748shLeft = shTopLeftCe
This VBA code is used to resize and reposition images in a specific range of cells in the active worksheet. The code loops through all the shapes in the worksheet and checks if the top-left cell address of each shape matches any of the specified cell addresses. If there is a match, the code resizes and repositions the image to be centered within the cell.
The code also sets the LockAspectRatio property of each shape to msoFalse, which allows the image to be resized without maintaining its original aspect ratio.
Overall, this code can be useful for quickly formatting a set of images in a specific range of cells in an Excel worksheet.
原文地址: https://www.cveoy.top/t/topic/99n 著作权归作者所有。请勿转载和采集!