How to rotate an image based on a cell value in Excel?
In Excel, we can rotate the image by dragging the mouse, but have you ever tried to rotate an image based on a cell value. For instance, the image will be rotated by 90 degrees if the cell value is 90 in Cell A1 as below screenshot shown.
Rotate an image based on cell value with macro code
Rotate an image based on cell value with macro code
Only a macro code can help you to rotate an image based on a cell value in Excel.
1. Type a value into the Cell A1 you will rotate the image by, and then activate the image you want to rotate.
2. Press Alt + F11 keys to enable the Microsoft Visual Basic for Applications window, and click Insert > Module to insert a blank new Module. See Screenshot:
3. Paste below code to the Module script, then press F5 to run the code. See screenshot:
VBA: Rotate image by cell value
Sub RotateImage()
Selection.ShapeRange.IncrementRotation ActiveSheet.Range("A1").Value
End Sub
Note: in the code, A1 is the cell you want to rotate the image based on, you can change it as you need.
Relative Articles:
- How to rotate footer/header text while in Landscape mode in Excel?
- How to rotate table by 90 or 180 degrees in Excel?
Best Office Productivity Tools
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Easy to Uninstall Completely
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need Is Just A Click Away...
Supercharge Your Excel Skills: Experience Efficiency Like Never Before with Kutools for Excel (Full-Featured 30-Day Free Trial)
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day! (Full-Featured 30-Day Free Trial)





