Option Explicit: Option Base 1
Sub ChercheProche()
Dim DL%, T, L%, Pointeur%, i%, Xthéo, Erreur, Distance
Application.ScreenUpdating = False
DL = Sheets("LEVEE").[A65500].End(xlUp).Row
T = Sheets("LEVEE").Range("B2:D" & DL) ' Tranfert Levée dans array
DL = [A65500].End(xlUp).Row
Range("C3:C" & DL).ClearContents: Range("F3:F" & DL).ClearContents: Range("I3:I" & DL).ClearContents
For L = 3 To DL
Pointeur = 0: Erreur = 9 ^ 9
Xthéo = Cells(L, "B"): Ythéo = Cells(L, "E")
For i = 1 To UBound(T)
Distance = Sqr(Abs(T(i, 1) - Xthéo) ^ 2 + Abs(T(i, 2) - Ythéo) ^ 2)
If Distance < Erreur Then
Erreur = Distance
Pointeur = i
End If
Next i
If Pointeur <> 0 Then
Cells(L, "C") = T(Pointeur, 1) ' Actualisations valeurs
Cells(L, "F") = T(Pointeur, 2)
Cells(L, "I") = T(Pointeur, 3)
End If
Next L
End Sub