PC Review


Reply
Thread Tools Rate Thread

Distance between Forms

 
 
Grupos de Noticias
Guest
Posts: n/a
 
      3rd Nov 2006
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
(E-Mail Removed)m



 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      3rd Nov 2006
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
> (E-Mail Removed)m
>
>
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
<H2> and distance in a CSS Hans Microsoft Frontpage 15 13th Nov 2008 07:55 AM
Distance Calculation =?Utf-8?B?SlNwZW5jZTIwMDM=?= Microsoft Excel Programming 3 7th Aug 2007 09:34 PM
Distance between cells =?Utf-8?B?R2FyeScncyBTdHVkZW50?= Microsoft Excel Misc 6 3rd Dec 2005 03:10 AM
distance david Windows XP Setup 1 11th Dec 2003 09:46 PM
Calculation of distance Martin Thorson Microsoft Excel Worksheet Functions 0 25th Jul 2003 08:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:59 PM.