Salut à Thierry et à tous
voila la macro entière si ça t'en dit d'avantage :
Dim MyArray(0 To 250) As String 'adapter
Dim Cell As Range
Dim Plage As Range
Dim WSSource As Worksheet
Dim WSCible As Worksheet
Dim i As Integer
Dim ii As Integer
Dim iii As Integer
Set WSSource = sheets("Intervention_Type_Machine")
Set Plage = sheets("Planning").Range("A27") 'à adapter
ii = 0
For Each Cell In Plage
For i = 1 To 250 ' à adapter
If Cell.Value = "" Then Exit Sub
If Cell.Value = WSSource.Cells(i, 1) Then
MyArray(ii) = MyArray(ii) & ", " & WSSource.Cells(i, 2).Value
Cell.Offset(0, 1).Value = WSSource.Cells(i, 2)
iii = iii + 1
End If
Next i
If MyArray(ii) = "" Then
MsgBox "Pas de Ville avec ce code Postal : " & Cell.Value, vbCritical, "Thierry's Démo"
Exit Sub
End If
With Cell.Offset(0, 1).Validation
.Delete
.Add Type:=xlValidateList, _
Operator:=xlBetween, _
AlertStyle:=xlValidAlertStop, _
Formula1:=MyArray(ii)
End With
If iii > 1 Then
Cell.Offset(0, 1).Value = ""
End If
MyArray(ii) = ""
ii = 0
iii = 0
Next Cell
End Sub
Bonne journée tout le monde