Results 1 to 8 of 8

Calculating Distance between 2 points.

Threaded View

  1. #1
    Registered User
    Join Date
    08-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    7

    Calculating Distance between 2 points.

    I'm having trouble calculating multiple distances for different sets of points.
    I can make the code to calculate a single distance between 2 points but I cannot make the program to calculate multiple points with a single click. If anyone can help, that would be great. This is what I have so far to calculate a single distance for 2 points.
    Private Sub cmdDistCalc_Click()
    
    Dim Ax, Ay, Bx, By As Double
    Dim dist As Double
    
    Ax = Cells(2, 1)
    Ay = Cells(2, 2)
    Bx = Cells(2, 3)
    By = Cells(2, 4)
    
    dist = ((Ax - Bx) ^ 2 + (Ay - By) ^ 2) ^ 0.5
    
    Cells(2, 5) = dist
    
    End Sub
    I will attach the file as well as I have more questions in it.

    Thank you.
    Attached Files Attached Files
    Last edited by isdouble; 08-19-2012 at 11:35 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1