Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 And Target.Count = 1 Then
If Target <> "" Then
If IsError(Application.Match(Target.Value, [Lieudit], 0)) Then
If MsgBox("Nouveau lieu-dit?", vbYesNo) = vbYes Then
[Lieudit].End(xlDown).Offset(1, 0) = Target.Value
LambertX
LambertY
Sheets("BASE").[Lieudit2].Sort key1:=Sheets("BASE").Range("A2")
Else
Application.Undo
End If
End If
End If
End If
End Sub
'-----------
Sub LambertX()
Dim Lx As String
Do Until Lx >= [MinX] And Lx <= [MaxX]
Lx = InputBox("Entre " & Format([MinX], "##,##0") & " et " & Format([MaxX], "##,##0"), "Coordonnées Lambert X")
Loop
[Lieudit].End(xlDown).Offset(0, 1) = Lx
End Sub
'-----------
Sub LambertY()
Dim Ly As String
Do Until Ly >= [MinY] And Ly <= [MaxY]
Ly = InputBox("Entre " & Format([MinY], "##,##0") & " et " & Format([MaxY], "##,##0"), "Coordonnées Lambert Y")
Loop
[Lieudit].End(xlDown).Offset(0, 2) = Ly
End Sub