Sub raz()
Sheets(2).Cells.Clear
End Sub
Sub trans()
raz
Dim temoins As Boolean, mot$, p&, x&, oldmot$
Application.ScreenUpdating = False
With Sheets("base ")
mot = ""
For Each cel In .Range("A2:A51")
mot = cel.Text
If mot <> "" Then
firstrow = Sheets("Résultat").Cells(Rows.Count, 2).End(xlUp).Offset(1).Row
Sheets("Résultat").Cells(firstrow, 1) = mot
With Sheets("Résultat").Cells(firstrow, 1).End(xlUp)
If mot <> oldmot Then .Value = .Value & vbCrLf & "(" & x & " fois)"
End With
x = 0
oldmot = mot
For i = 2 To .Cells(Rows.Count, 2).End(xlUp).Row
p = InStr(1, .Cells(i, 2).Value, mot)
If p > 0 Then
.Cells(i, 2).Characters(p, Len(mot)).Font.ColorIndex = 3
x = x + 1
.Cells(i, 2).Resize(, 6).Copy Destination:=Sheets("Résultat").Cells(Rows.Count, 2).End(xlUp).Offset(1)
Debug.Print Cells(i, 2).Address(0, 0) & " position " & p
p = 0
End If
Next
End If
Next
End With
End Sub