N
nitn28
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
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