ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   excel positioning in Points for vba shapes (https://www.excelbanter.com/excel-worksheet-functions/118829-excel-positioning-points-vba-shapes.html)

Kelzina

excel positioning in Points for vba shapes
 
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???
--
"The difference between Possible and Impossible is the measure of ones will"

Bernie Deitrick

excel positioning in Points for vba shapes
 
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


"Kelzina" wrote in message
...
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???
--
"The difference between Possible and Impossible is the measure of ones will"





All times are GMT +1. The time now is 07:28 AM.

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