Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim objIntersect As Range
Static strAddress As String
On Error Resume Next
'Supprime s'il existe le dernier comment ouvert
If Range(strAddress).Comment.Visible = True Then
Range(strAddress).Comment.Delete
End If
If Intersect(Range('J2:J5'), Target) Is Nothing Then
If Range(strAddress).Comment.Visible = True Then
Range(strAddress).Comment.Delete
End If
Exit Sub
Else
ActiveCell.AddComment (ActiveCell.Offset(0, 1))
ActiveCell.Comment.Visible = True
' Récupère l'adrese du Comment ouvert
strAddress = ActiveCell.Address
End If
End Sub