Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a picture (a compass arrow). I am trying to write a macro that will
rotate the image based on a value contained in a cell. Lets say the azimuth is 87 degrees, then cell K9 would contain the value 87. I would like the arrow to rotate by 87 deg, to visually reflect the azimuth. So fare I am able to get the shape to rotate by a fixed value by using for example Selection.ShapeRange.IncrementRotation 87# How do I have excel pick the value in cell K9 and rotate the object accordingly? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Untested...
Selection.ShapeRange.IncrementRotation activesheet.range("k9").value elwood wrote: I have a picture (a compass arrow). I am trying to write a macro that will rotate the image based on a value contained in a cell. Lets say the azimuth is 87 degrees, then cell K9 would contain the value 87. I would like the arrow to rotate by 87 deg, to visually reflect the azimuth. So fare I am able to get the shape to rotate by a fixed value by using for example Selection.ShapeRange.IncrementRotation 87# How do I have excel pick the value in cell K9 and rotate the object accordingly? -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
great thanks - is there a function for absolute rotation? Lets say the image sits a 87 to start with and I want to rotate it back to 0 - Currently if i enter 0, obviously nothing happens, since the rotation is relative.
--- frmsrcurl: http://msgroups.net/microsoft.public...-on-cell-value |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'd suggest you putting something in the Worksheet_SelectionChange procedure
to capture the value in the range of interest BEFORE you change it. Once it's changed, you can recalculate the angle and set it. You will probably need a public variable to do this. -- HTH, Barb Reinhardt "elwood" wrote: great thanks - is there a function for absolute rotation? Lets say the image sits a 87 to start with and I want to rotate it back to 0 - Currently if i enter 0, obviously nothing happens, since the rotation is relative. --- frmsrcurl: http://msgroups.net/microsoft.public...-on-cell-value . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
that's exactly what i would do, if i had the slightest idea how.... ;)
--- frmsrcurl: http://msgroups.net/microsoft.public...-on-cell-value |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You very rarely need to select an object to work with it. By not selecting the
object, it should make the code easier to read, too. Option Explicit Sub testme() Dim myShape As Shape Set myShape = ActiveSheet.Shapes("Picture 1") myShape.IncrementRotation 45 MsgBox "Hey, it's crooked!" myShape.Rotation = 0 MsgBox "Back to normal!" End Sub elwood wrote: great thanks - is there a function for absolute rotation? Lets say the image sits a 87 to start with and I want to rotate it back to 0 - Currently if i enter 0, obviously nothing happens, since the rotation is relative. --- frmsrcurl: http://msgroups.net/microsoft.public...-on-cell-value -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks again - makes a lot of sense. I have to admit, I know nothing about VB, so I just used the first example i could find that I half way understood and got to work....
--- frmsrcurl: http://msgroups.net/microsoft.public...-on-cell-value |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change Picture based on cell value | Excel Worksheet Functions | |||
Rotate a Picture | Excel Programming | |||
If statement to add picture based on cell value | Excel Programming | |||
How to add picture based on a cell value | Excel Discussion (Misc queries) | |||
How I do I rotate text in an excel cell? The rotate commands is g. | Excel Discussion (Misc queries) |