excel positioning in Points for vba shapes

K

Kelzina

i want to know how to determine where (in Points) to position an autoshape
using vba (without recording a macro).
aparently shapes lines etc use a point system to position themselves using
start x axis, start y axis, end x asis and end y axis.

1. is it possible to view how many point there in in relation to a cell
reference, and
2. is it even possible to figure out the point system without recording a
macro???
 
B

Bernie Deitrick

Kelzina,

Position your shape relative to cells using the Top and Left properties of the range objects. This
example will draw a line from the upper left of B2 to the upper left of H8:

Sub AddLine()
Dim StartCell As Range
Dim EndCell As Range

Set StartCell = Range("B2")
Set EndCell = Range("H8")

ActiveSheet.Shapes.AddLine StartCell.Left, StartCell.Top, EndCell.Left, EndCell.Top

End Sub

HTH,
Bernie
MS Excel MVP
 
Top