PC Review


Reply
Thread Tools Rate Thread

Connecting lines

 
 
=?Utf-8?B?Y2hvaWNl?=
Guest
Posts: n/a
 
      21st Jan 2007
If I have a range in excel that has angles in degrees in one column and
lengths in the next.
ANGLE LENGTH
90 5
225 6
90 5

How could i draw a line with segments that have those dimensions (assuming
north is up) (Those dimension should end up drawing something like a Z)

Thanks in advance
 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      21st Jan 2007
One way:

Public Sub DrawLines()
' cdConvToRads = Pi / 180
Const cdConvToRads As Double = 0.0174532925199433
Const cdScaleFactor As Double = 2
Dim rCell As Range
Dim dAngle As Double
Dim dLen As Double
Dim dStartX As Double
Dim dStartY As Double
Dim dEndX As Double
Dim dEndY As Double

dStartX = 100
dStartY = 100
With ActiveSheet
For Each rCell In Range(.Cells(2, 1), _
.Cells(.Rows.Count, 1).End(xlUp))
With rCell
dAngle = .Value * cdConvToRads
dLen = .Offset(0, 1).Value * cdScaleFactor
End With
dEndX = dStartX + dLen * Sin(dAngle)
dEndY = dStartY - dLen * Cos(dAngle)
.Shapes.AddLine dStartX, dStartY, dEndX, dEndY
dStartX = dEndX
dStartY = dEndY
Next rCell
End With
End Sub

In article <3D99C100-F2FE-4D98-A540-(E-Mail Removed)>,
choice <(E-Mail Removed)> wrote:

> If I have a range in excel that has angles in degrees in one column and
> lengths in the next.
> ANGLE LENGTH
> 90 5
> 225 6
> 90 5
>
> How could i draw a line with segments that have those dimensions (assuming
> north is up) (Those dimension should end up drawing something like a Z)
>
> Thanks in advance

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting lines Richard Microsoft Word Document Management 1 8th Oct 2008 01:01 PM
Connecting lines disappear =?Utf-8?B?Q2hyaXM=?= Microsoft Excel Misc 0 28th Jul 2007 03:14 PM
Connecting Cell with Lines jerry Microsoft Excel Discussion 1 17th Oct 2006 05:59 AM
Leader Lines Connecting Chart to Box =?Utf-8?B?VE9NQg==?= Microsoft Excel Charting 1 7th May 2005 06:00 PM
connecting two chart lines bob Microsoft Excel Charting 2 26th Aug 2004 03:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:46 PM.