Solved

Rotate shape in XLS

Posted on 2014-03-28
5
427 Views
Last Modified: 2014-03-28
In Excel, I can rotate an image via the code below.    How do I modify the ActiveSheet VBA line in order to rotate a "shape" (e.g., arrow).    I tried the following lines but they don't seem to work:

ActiveSheet.Shape("BearingArrow").ShapeRange.Rotation = Target
ActiveSheet.Shapes("BearingArrow").ShapeRange.Rotation = Target

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$1" Then
        ActiveSheet.Pictures("Picture 1").ShapeRange.Rotation = Target
    End If
End Sub

Open in new window

0
Comment
Question by:ExpExchHelp
  • 3
  • 2
5 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39961718
Hi,

pls try


Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$A$1" Then
        IncrRotation = Target.Value - Selection.ShapeRange.Rotation
        ActiveSheet.Pictures("Picture 1").ShapeRange.IncrementRotation = IncrRotation
    End If
End Sub

Open in new window

Regards
0
 

Author Comment

by:ExpExchHelp
ID: 39961721
Rgonzo1971:

The picture rotation works great as is.   I need to figure out how to rotate shapes.

Lines below don't work:
ActiveSheet.Shape("BearingArrow").ShapeRange.Rotation = Target
ActiveSheet.Shapes("BearingArrow").ShapeRange.Rotation = Target

EEH
0
 

Author Comment

by:ExpExchHelp
ID: 39961754
Never mind... I found a solution.   See below.

Will award you the points anyways (for chiming in here).

EEH
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 39961768
Hi,

You maybe found

ActiveSheet.Shapes("BearingArrow").DrawingObject.ShapeRange.Rotation = 25

Open in new window

Regards
0
 

Author Comment

by:ExpExchHelp
ID: 39961829
Rgonzo1971:

Thx -- solution is slightly different.   However, I now realized that the shape is rotating on its won axis vs. on, e.g., start point.

Please see attached XLS for details.   Any ideas how to change the VBA to so arrow rotates (based on value 0-360 in cell A1) but rotates on red circle?

EEH
RotateArrow.xlsm
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now