1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Private Sub rue_Change()
Dim ligne As Long
Dim derlign As Long
Set f2 = Sheets("BDD_rues")
derlign = f2.Cells(Rows.count, 1).End(xlUp).Row
ligne = f2.[E:E].Find(What:=CP).Row 'ici je me positionne sur la 1ère cellule comprenant le CP souhaité
For i = Cells(ligne, 5).Row To derlign Step 1
'If Cells(ligne, 5) = Cells(ligne + 1, 5) Then 'Tu as utilisé la variable "ligne" dans ton test, mais ligne ne varie pas avec le for. Il faut remplacer par "i"
If Cells(i, 5) = Cells(i+ 1, 5) Then
Me.rue.AddItem f2.Cells(ligne, "G")
Else
Exit For
End If
Next i
Me.rue.DropDown
End Sub |