Compass Heading drawing from an angles list

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top