Sub init_commentaire()
Dim Plage As Range
Dim Vcellule As Range
Dim Vfind As Range
Dim Comment() As String
Dim Commentaire_entier As String
Dim i As Integer
Dim j As Integer
Dim k As Integer
With Worksheets("Recherche acet")
Set Plage = .Range("A1:DZ65")
For Each Vcellule In Worksheets("liste_outil").Range("A2:A" & Worksheets("liste_outil").Range("A5").End(xlDown).Row)
i = 0
j = 0
ReDim Comment(1, 0)
Comment(0, 0) = "$A$1"
Vcellule.ClearComments
Do While j = 0
Set Vfind = Plage.Find(Vcellule, .Range(Comment(0, i)), LookIn:=xlValues)
If Vfind Is Nothing Then
j = 1
Else
For k = 0 To UBound(Comment, 2)
If Comment(0, k) = Vfind.Address Then j = 1
Next k
End If
If j = 0 Then
i = i + 1
ReDim Preserve Comment(1, i)
Comment(0, i) = Vfind.Address
Comment(1, i) = Vfind.Column
End If
Loop
For j = 1 To UBound(Comment, 2)
Commentaire_entier = Commentaire_entier & .Cells(1, CInt(Comment(1, j))).Value & " " & .Cells(2, CInt(Comment(1, j))).Value _
& " " & .Cells(3, CInt(Comment(1, j))).Value & vbLf
Next j
If Commentaire_entier <> "" Then
Vcellule.AddComment
Vcellule.Comment.Text Commentaire_entier
Vcellule.Comment.Shape.TextFrame.AutoSize = True
Commentaire_entier = ""
End If
Next
End With
End Sub