Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default VBa Locate Nearest point

hello every one

i m working with GPS Coordinates [cartesian coordinates]

i want to locate nearest point at present m using this formula to
locate nearrest point provided by Mr. Joel afew days back it worked
fine

Sub sortdistance()

LastRowA = Cells(Rows.Count, "A").End(xlUp).Row
LastRowE = Cells(Rows.Count, "E").End(xlUp).Row

For i = 1 To LastRowA
X = Cells(i, "A")
Y = Cells(i, "B")

For j = 1 To LastRowE
distance = Sqr((X - Cells(j, "E")) ^ 2 + (Y - Cells(j, "F")) ^
2)
If j = 1 Then
shortX = Cells(j, "E")
shortY = Cells(j, "F")
shortdistance = distance
Else
If distance < shortdistance Then
shortX = Cells(j, "E")
shortY = Cells(j, "F")
shortdistance = distance
End If
End If
Next j

Cells(i, "C") = shortX
Cells(i, "D") = shortY
Next i

End Sub


but i want to knw is there anyother way "more presice n accurate" to
locate nearest point

hope sumbody wud find time to help me out
many thanx in advance

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
how to locate a point on excel graph? logetic Charts and Charting in Excel 6 April 26th 23 03:45 AM
How do i locate the point of intersection of two lines graphs Nana Adwoa Charts and Charting in Excel 4 April 2nd 23 07:58 PM
Excel VBA locate nearest point [email protected] Excel Programming 2 April 25th 07 09:00 PM
Rounding to the nearest quarter point? George Excel Discussion (Misc queries) 3 June 10th 06 10:12 PM
Find the nearest point to 1000 rows where "amounts" balance and apply special formatting to that row Paul Excel Programming 4 October 14th 05 05:02 PM


All times are GMT +1. The time now is 09:27 AM.

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

About Us

"It's about Microsoft Excel"