Build macro to draw lines between multiple points

G

Guest

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
 
B

Bob Phillips

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

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

Top