• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Rotate object between 0 to 360 degrees when cell value is changed

iskoako

New Member
Good afternoon to All.


I would like to make an object rotate (an arrow) if the cell value is changed, then the object rotates as well.


Thank you in advance.
 
Hi Iskoako,


Welcome to this forum...


You might be interested in looking at this thread:


http://chandoo.org/wp/2009/11/06/fancy-gauge-chart/


Kaushik
 
You could use some geometry and plug the number (1-360) into some SIN and COS functions to generate x and y coordinates on a line chart. Have the line on the chart formatted to be an arrow (format shape I believe). Hide all unwanted objects on chart (legend, axis, etc) and shrink chart down to desired size.
 
thanks much guys . . . but what if i want an object (a ship) to rotate when i change the value of a cell it refers to?
 
Hi !   Maybe I have your needs in VBA but could you tell us how a cell refers to the shape ?
 
Hi ,


Try this :

[pre]
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Application.Intersect(Target, Range("Picture_cell")) Is Nothing Then Exit Sub
With ActiveSheet.Shapes("Picture 1")
If Val(.AlternativeText) < Target Then
.IncrementRotation 30
Else
.IncrementRotation -30
End If
.AlternativeText = Target
End With
End Sub
[/pre]
Initially , if your linked cell ( which I have named Picture_cell ) contains 0 , ensure that your shape is horizontal ; thereafter , as you change the value of the linked cell positively i.e. you increase its value , your shape will rotate clockwise , if you change it negatively i.e. you reduce its value , your shape will rotate counter-clockwise.


Narayan
 
Back
Top