![]() |
Distance between Forms
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 |
Distance between Forms
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 |
All times are GMT +1. The time now is 09:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com