Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Distance calculations not bright New Users to Excel 6 January 15th 11 04:14 PM
distance calculations not bright New Users to Excel 1 August 21st 07 12:40 PM
Distance between zip codes Squid Excel Worksheet Functions 2 March 10th 05 04:27 AM
Distance To Margin Jeff Haumesser Excel Programming 0 February 8th 05 01:12 AM
Euclidian Distance Christina Excel Discussion (Misc queries) 5 January 20th 05 04:47 PM


All times are GMT +1. The time now is 02:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"