Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case [K5].Address: Set_Comment Target, Application.VLookup(Target, [Tbpaiement[Paiement]].Resize(, 2), 2, False)
Case [K16].Address: Set_Comment Target, Application.VLookup(Target, [TbTag[Tag]].Resize(, 2), 2, False)
End Select
End Sub
Sub Set_Comment(ByVal Target As Range, ByVal Text As String)
Dim Com
With Target
If Not .Comment Is Nothing Then .Comment.Delete
With .AddComment(Replace(Text, ":", vbLf)).Shape.DrawingObject
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.AutoSize = True
.Font.Italic = True
End With
T = Split(Text, ":")
If UBound(T) = 1 Then
With .Comment.Shape.TextFrame
With .Characters(1, Len(T(0))).Font
.Color = vbBlue
.Bold = True
.Italic = False
End With
With .Characters(Len(T(0)) + 1, Len(T(1)) + 1).Font
.Color = vbBlack
End With
End With
End If
End With
End Sub