This article will tell you how to rotate a picture in Excel manually or programmatically with examples.
1. How To Rotate A Picture In Excel Manually.
- Insert a picture into your Excel worksheet ( you can read the article How To Insert And Stick Picture In Excel Cell To Move, Resize, And Filter The Picture With The Cell ).
- Click the picture to select it, then you will find there is a rotation icon on the top middle of the image.
- Move your mouse pointer to the rotation icon, and click the left mouse key.
- Then you can rotate the picture by rotating your mouse pointer to the left or the right.
- You can also change the picture size by dragging the circle dot on each center point or corner point of the picture.
- Besides the above method, you can right-click the picture, and then click the Format Picture… menu item to open the Format Picture pane on the right side.
- Click the third Size & Properties tab on the Format Picture pane.
- Expand the Size arrow, then you can adjust the picture size and rotation value in the related text field.
2. How To Rotate A Picture In Excel Programmatically.
- If you want to rotate a picture in Excel programmatically, you need to use VBA.
- Input an integer number in Excel cell A1, and the picture will rotate the degree based on this integer number.
- Click to select the image and click the Developer tab —> Visual Basic icon to open the Visual Basic editor window.
- In the pop-up Microsoft Visual Basic for Applications window, click the Insert —> Module menu item to insert a new module.
- Copy the below VBA source code into the new module editor window.
Sub RotatePicture() Selection.ShapeRange.IncrementRotation ActiveSheet.Range("A1").Value End Sub
- Click the green Run button on the top toolbar to run the above code.
- Then you will see the picture is rotated on the Excel worksheet.
- You can change the value in Excel cell A1, and run the VBA source code again to see different effects.
- You should select the picture first before running the VBA source code, otherwise, you may encounter the Run-time error ‘438’ Object doesn’t support this property or method.