Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to locate a point on excel graph? | Charts and Charting in Excel | |||
How do i locate the point of intersection of two lines graphs | Charts and Charting in Excel | |||
Excel VBA locate nearest point | Excel Programming | |||
Rounding to the nearest quarter point? | Excel Discussion (Misc queries) | |||
Find the nearest point to 1000 rows where "amounts" balance and apply special formatting to that row | Excel Programming |