There are two ways of rotating a shape, absolute or relative. An absolute direction always counts from 0, a relative one from the shape's current direction. In the attached workbook there are three worksheets, one each demonstrating absolute and relative rotation and the third one doing both. Each of these sheets has its code. You can copy/paste the code to the code sheet of your own project or you can copy/paste the entire sheet in which case Excel will include the code in the process. You must save the resulting workbook as macro-enabled (xlms extension) if you use Excel 2007 or later.
The code requires two adjustments to match the environment on your worksheet.
- Define the relevant cells
At the top of the code you will find constants, like these.
Const AbsAngle As String = "A1"
Const RelAngle As String = "A2"
Const AngleCell As String = "C14"
You can specify the cells where the rotation angles will be entered. The last one is an output cell where the achieved absolute rotation angle will be indicated after a relative rotation was carried out. You can specify any cells on the worksheet. Only the Absolute or Relative rotation requires all three cells. - Specify the shape to be rotated.
In place of this code: Set Sh = Shapes("MyShape")
you could use this: Set Sh = Shapes(1)
All the shapes in each worksheet are numbered. Excel also gives them a name. If you have only one it may be most convenient just to use the second syntax - addressing it as "Shapes(1)"
Use the procedure ResetApplication if your code ever crashes and Excel becomes unresponsive therafter. Run any of these procedures by placing the cursor anywhere within it and press F5. GetName and SetName require you to select the shape you are interested in on the worksheet first. Copy the entire module into your project by dragging it in the Project Explorer window of the VB Editor.