Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim Ref_Lat As Double, Ref_Lon As Double, X_lat As Double, X_lon As Double, D As Double
Dim Max_Lat As Double, min_Lat As Double, Max_Lon As Double, min_Lon As Double
Dim message As String, cell As Range
If Target.Column <> 1 Then Exit Sub
Ref_Lat = Target.Offset(0, 5): Ref_Lon = Target.Offset(0, 6)
Max_Lat = Ref_Lat + 0.1: Max_Lon = Ref_Lon + 0.1
min_Lat = Ref_Lat - 0.1: min_Lon = Ref_Lon - 0.1
For Each cell In Range("villes")
If cell.Offset(0, 5) < Max_Lat And cell.Offset(0, 5) > min_Lat And cell.Offset(0, 6) < Max_Lon And cell.Offset(0, 6) > min_Lon Then
D = 111 * ((Ref_Lat - cell.Offset(0, 5)) ^ 2 + (Ref_Lon - cell.Offset(0, 6)) ^ 2) ^ 0.5
message = message & cell & " " & Format(D, "0.000") & "km" & Chr(10)
End If
Next
MsgBox message
Cancel=True
End Sub