Sub updateControles()
Dim referentiel As Range, controle As Range, machine As Range, valCherchee As Range, curCell As Range[COLOR="Red"][B], i As Integer[/B][/COLOR]
[COLOR="Red"][B]i = 1[/B][/COLOR]
'____________________________________________________________________
'________________variables à adapter_________________________________
'
Set referentiel = ThisWorkbook.Sheets("Référentiel").Range("A5:E11")
Set controle = ThisWorkbook.Sheets("Sélection").Range("A11")
Set machine = ThisWorkbook.Sheets("Sélection").Range("B5")
'____________________________________________________________________
Range(controle, controle.End(xlDown)[COLOR="Red"][B].Offset(0, 1)[/B][/COLOR]).ClearContents
Set valCherchee = referentiel.Find(what:=machine.Value, LookIn:=xlValues, lookat:=xlWhole)
If valCherchee Is Nothing Then Exit Sub
For Each curCell In Application.Intersect(referentiel, valCherchee.EntireColumn).Resize(referentiel.Rows.Count - 1, 1).Offset(1, 0)
If UCase(curCell.Value) = "X" Then
[COLOR="Red"][B]controle.Value = i
i = i + 1
controle.Offset(0, 1).Value = curCell.Offset(0, referentiel.Column - curCell.Column)[/B][/COLOR]
Set controle = controle.Offset(1, 0)
End If
Next curCell
End Sub