Salut cpin, steelson,
macro corrigée à coller dans le module de 'Filtre'.
Private Sub Worksheet_Change(ByVal Target As Range)
'
Dim tData
Dim sData As String, sNom As String, sSheet As String
'
Application.EnableEvents = False
Application.ScreenUpdating = False
'
If Not Intersect(Target, Range("D6")) Is Nothing Then 'si changement en [D6]
sNom = Target 'sData = nom
iRow = Range("D" & Rows.Count).End(xlUp).Row 'fond de la colonne [C] pour nettoyage...
If iRow > 24 Then '... si c'est déjà rempli
Range("A25:F" & iRow).ClearContents
Range("G25:R" & iRow).Interior.Color = xlNone
Range("A25:R" & iRow).Borders.LineStyle = xlNone
End If
iRow = 24
'préparation pour nouvel affichage
For x = 1 To Sheets.Count
If Left(Sheets(x).Name, 1) = "P" Then
sSheet = Sheets(x).Name 'choix des feuilles à scanner...
With Worksheets(sSheet)
For y = 4 To .Range("K" & Rows.Count).End(xlUp).Row '... jusqu'au fond de la colonne [K]
If InStr(.Cells(y, 11), sNom) > 0 Then 'si cellule contient sNom
sData = .Cells(y, 11)
If Right(sData, 1) <> Chr(10) Then sData = .Cells(y, 11) & Chr(10)
tData = Split(sData, Chr(10))
If WorksheetFunction.CountIf(.Range("M" & y).Resize(1, 12), "2") > 0 Then
iRow = iRow + 1 'ligne d'affichage
Cells(iRow, 3) = sSheet & " - " & y 'nom feuille + ligne
Cells(iRow, 4) = sNom 'nom
For Z = 5 To 6
If .Range(IIf(Z = 5, "D", "J") & y).MergeCells Then
Cells(iRow, Z) = .Range(IIf(Z = 5, "D", "J") & y).MergeArea.Cells(1, 1)
Else
Cells(iRow, Z) = .Range(IIf(Z = 5, "D", "J") & y).Value 'risque
End If
Next
For Z = 1 To 12 'couleurs
Cells(iRow, 6 + Z).Interior.Color = .Cells(y, 12 + Z).Interior.Color
Next
If UBound(tData) > 1 Then
For Z = 0 To UBound(tData) - 1
If Trim(tData(Z)) <> sNom Then
iRow = iRow + 1
Cells(iRow, 4) = tData(Z)
End If
Next
End If
End If
End If
Next
End With
End If
Next
iRow = Range("D" & Rows.Count).End(xlUp).Row
If iRow > 24 Then Range("C25:R" & iRow).Borders.LineStyle = xlContinuous
End If
'
Application.ScreenUpdating = True
Application.EnableEvents = True
'
End Sub
@Steelson : joli essai!
Je dois maintenant trouver l'inspiration pour terminer un travail pour Aziler. Je reviens après pour suivre ceci de près.
A+