Commentaire

Bonjour,

Comment tester si un commentaire existe en (K1) si oui si non
Le code ci-dessous me dit Non alors qu'il y en a un
Le but étant de le supprimer s'il y en a un, d'en mettre un dans le cas contraire
En vous remerciant
Sub SiCommentaire()
Dim Comment
    If Range("K1") = Comment Then
    MsgBox "Oui"
    Else
        MsgBox "Non"
End If
End Sub


2 réponses

  1. Bonjour

    Teste comme ceci
    Sub SiCommentaire()
    Dim Comment
      If Not (Range("K1").Comment Is Nothing) Then
        MsgBox "Oui"
      Else
        MsgBox "Non"
      End If
    End Sub
    0
    1. Bonjour M-12
      Merci de m'avoir répondu
      Comment remplacer le MsgBox "Oui"
      par action demandée : effacer le commentaire :
      0