This post will guide how to quickly change properties of all pictures in the current worksheet automatically. How do I automatically change all pictures to move a size with cells in your worksheet with VBA macro code in excel.
By default, after you inserted a picture into worksheet, it will keep the default properties of move and don’t size with cells. And you need to change its properties to move and size with cells by manually in your worksheet.
Let’s do the following steps to automatically change properties of all pictures:
#1 open your excel workbook and then click on “Visual Basic” command under DEVELOPER Tab, or just press “ALT+F11” shortcut.
#2 then the “Visual Basic Editor” window will appear.
#3 click “Insert” ->”Module” to create a new module
#4 paste the below VBA code into the code window. Then clicking “Save” button.
Sub AutoMoveAndSizeWithCells() Dim xPic As Picture For Each xPic In ActiveSheet.Pictures xPic.Placement = xlMoveAndSize Next End Sub
#5 back to the current worksheet, then run the above excel macro. Click Run button.
You will see the all pictures are changed to move and size with cells automatically after running the above vba code.