Commentaire

jean300 Messages postés 382 Statut Membre -  
jean300 Messages postés 382 Statut Membre -
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. M-12 Messages postés 1349 Statut Membre 285
     
    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
  2. jean300 Messages postés 382 Statut Membre 14
     
    Bonjour M-12
    Merci de m'avoir répondu
    Comment remplacer le MsgBox "Oui"
    par action demandée : effacer le commentaire :
    0