ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Compass Heading drawing from an angles list (https://www.excelbanter.com/excel-programming/391936-compass-heading-drawing-angles-list.html)

Mahieux

Compass Heading drawing from an angles list
 
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

Peter T

Compass Heading drawing from an angles list
 
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" wrote in message
...
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




Mahieux

Compass Heading drawing from an angles list
 
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" wrote in message
...
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





Peter T

Compass Heading drawing from an angles list
 
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" wrote in message
...
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" wrote in message
...
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







John[_131_]

Compass Heading drawing from an angles list
 
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
...
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" wrote in message
...
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" wrote in message
...
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









All times are GMT +1. The time now is 03:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com