Sub TrouveCathy()
Dim T
'on efface les anciens résultats
With Sheets("Feuil1")
.Range("L2:O" & .[A65536].End(xlUp).Row).Value = ""
T = .Range("A2:O" & .[A65536].End(xlUp).Row).Value
.[A2].Resize(UBound(T), UBound(T, 2)) = TrouveMot(T, LCase(Trim(.Cells(1, "r"))), 11, 12, 13, 14, 15)
End With
End Sub
Function TrouveMot(T, aTrouver$, ColR&, Col1&, Col2&, Col3&, Col4&)
'ColR , colonne où va cherhcer atrouver
'col1 =Qui,col2=société,col3=Annee1,col4=anne2
Dim Mots, I&, J&, K&
For K = LBound(T) To UBound(T)
Mots = Split(LCase(Trim(T(K, ColR))), "$")
For I = 0 To UBound(Mots)
If Mots(I) = aTrouver Or Mots(I) Like aTrouver & " *" _
Or Mots(I) Like "* " & aTrouver & " *" Or Mots(I) Like "* " & aTrouver _
Or Mots(I) Like "*'" & aTrouver & " *" Or Mots(I) Like "*'" & aTrouver Then
T(K, Col1) = T(K, 1)
T(K, Col2) = Mots(I)
J = I + 1
If J <= UBound(Mots) Then
If IsNumeric(Trim(Mots(J))) Then T(K, Col3) = CLng(Mots(J))
End If
J = I + 2
If J <= UBound(Mots) Then
If IsNumeric(Trim(Mots(J))) And (Trim(Mots(J - 1)) = "" Or IsNumeric(Trim(Mots(J - 1)))) Then T(K, Col4) = CLng(Mots(J))
End If
Exit For
End If
Next I
Next K
TrouveMot = T
End Function