Hello Mahieux,
Building on Peter's rotation advice, you could have a go with the following
code:
Sub AddCompassShapes()
Dim shp As Shape
Dim iRow As Integer
Dim iCol As Integer
Dim wks As Worksheet
Set wks = ActiveSheet
iRow = ActiveCell.Row
iCol = ActiveCell.Column
For x = 0 To 9
Set shp = wks.Shapes.AddShape(msoShapeUpArrow, _
Cells(iRow + x, iCol + 1).Left + _
((Cells(iRow + x, iCol + 2).Left - _
Cells(iRow + x, iCol + 1).Left) / 2), _
Cells(iRow + x, iCol + 1).Top, _
Cells(iRow + x, iCol + 1).Width / 3, _
Cells(iRow + x, iCol + 1).Height)
If Not Cells(iRow + x, iCol).Value = "" Then
shp.Rotation = Cells(iRow + x, iCol).Value
End If
Next x
End Sub
It's probably not very efficient but hopefully gives you the idea.
Additions to the code might include naming the shapes as you lay them down
so that you can refer to them later on. For example you could add the
follow line before the If statement line:
shp.Name = wks.Name & "-" & Cells(iRow + x, iCol).Address
This would give you the ability to get a reference to a cell's respective
arrow shape.
Anyway, hope that's helpful.
Best regards
John
"Peter T" <peter_t@discussions> wrote in message
news:(E-Mail Removed)...
>I don't really follow what you are trying to do.
>
> FWIW, revolving a compass style line is not as complicated as I implied.
> Start by drawing the line vertically from bottom to top, such that its mid
> point is on the axis. Then use the Rotation method.
>
> Regards,
> Peter T
>
> "Mahieux" <(E-Mail Removed)> wrote in message
> news:7C37678C-A3FA-4DB7-BAAB-(E-Mail Removed)...
>> I can survive with a preset shape group of circle and line ;-)
>> but the whole thing has to be in a macro still and I have 1200 GPS
> points....
>> for which each need a visu picture
>>
>> "Peter T" wrote:
>>
>> > ActiveSheet.Shapes(1).Rotation = Range("A1")
>> >
>> > If you mean revolve or set the angle of a line(arrow) around a central
>> > point, like a compass, it's a lot more complicated.
>> >
>> > Regards,
>> > Peter T
>> >
>> >
>> > "Mahieux" <(E-Mail Removed)> wrote in message
>> > news:C60A24F8-94DA-4C17-8980-(E-Mail Removed)...
>> > > Hi
>> > > Is there any simple way to rotate a basic shape based on the value in
> a
>> > > column :
>> > > say : the value contains 0 or 360 => heading North , the value shows
> 90 =>
>> > > heading East and so on. It so simple ......apparently but I did not
> find
>> > any
>> > > hook in Excel allowing to do this (aside of macros)
>> > > If you get any light on this ?
>> > > Thks in advance
>> >
>> >
>> >
>
>
|