Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I´m interested in obtaining the distance between two forms in an Excel Sheet
(for example two Rectangles:One in B3 and the other in F4). Wich is the distance between them? Excuse my English. -- Gracias. Cordialmente m |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
shapes have
top left width height properties. Sub abc() Dim shp1 As Shape, shp2 As Shape Dim x As Single, y As Single Dim d As Single Set shp1 = ActiveSheet.Shapes("Rectangle 1") Set shp2 = ActiveSheet.Shapes("Rectangle 2") x = shp2.Top - (shp1.Top + shp1.Height) y = shp2.Left - (shp1.Left + shp1.Width) d = (x ^ 2 + y ^ 2) ^ 0.5 Debug.Print x, y, d End sub this assumes shp1 is above and to the left of shp2 and measures the distance of the lower right corner of shp1 to the upper left corner of shp1. For a more general solution, you would have to add more code. -- Regards, Tom Ogilvy End Sub"Grupos de Noticias" wrote: I´m interested in obtaining the distance between two forms in an Excel Sheet (for example two Rectangles:One in B3 and the other in F4). Wich is the distance between them? Excuse my English. -- Gracias. Cordialmente m |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Distance calculations | New Users to Excel | |||
distance calculations | New Users to Excel | |||
Distance between zip codes | Excel Worksheet Functions | |||
Distance To Margin | Excel Programming | |||
Euclidian Distance | Excel Discussion (Misc queries) |