ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Build macro to draw lines between multiple points (https://www.excelbanter.com/excel-programming/295497-build-macro-draw-lines-between-multiple-points.html)

ANGIE

Build macro to draw lines between multiple points
 
I would like utlize the standard excel spreadsheet to represent a location grid in a machine shop for example. I would then like to be able to define movement of a product by specifying two differnet locations on the spreadhseet and then use a macro to draw all the lines between those points. See below

Grid - Use standard Excel as Templat
A B C D..
1
2
3
4
...

Points of Intersectio
Origination: Destination
A10 B
C7 D1

Macro
Draw line between points of intersection on a chart


Bob Phillips[_6_]

Build macro to draw lines between multiple points
 
Something like

Dim nStart1 As Double, nStart2 As Double
Dim nEnd1 As Double, nEnd2 As Double
Dim rng1 As Range
Dim rng2 As Range

Set rng1 = Range("A10")
Set rng2 = Range("B6")

nStart1 = rng1.Left + rng1.Width
nStart2 = rng1.Top
nEnd1 = rng2.Left + rng2.Width
nEnd2 = rng2.Top

ActiveSheet.Shapes.AddLine(nStart1, nStart2, nEnd1, nEnd2).Select

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Angie" wrote in message
...
I would like utlize the standard excel spreadsheet to represent a location

grid in a machine shop for example. I would then like to be able to define
movement of a product by specifying two differnet locations on the
spreadhseet and then use a macro to draw all the lines between those points.
See below

Grid - Use standard Excel as Template
A B C D...
1
2
3
4
...

Points of Intersection
Origination: Destination:
A10 B6
C7 D15


Macro:
Draw line between points of intersection on a chart.





All times are GMT +1. The time now is 11:01 PM.

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