XL 2010 Récupérer commentaire des cellules

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

Airone784

XLDnaute Occasionnel
Bonjour à tous,

Voici mon code pour lequel j'ai un pb :

VB:
sub commentaire

[ABX2:ACB10000].ClearContents


jour = Application.Match(CDbl(Date), Range("1:1"), 0)

For i = jour To 744 Step 2

For j = 5 To [A4].End(xlDown).Row

If Cells(j, i) <> "" Then
Range("ABY10000").End(xlUp).Offset(1, 0) = Cells(j, i)
Range("ABX10000").End(xlUp).Offset(1, 0) = CDate(Cells(3, i))
Range("ABZ10000").End(xlUp).Offset(1, 0) = Cells(j, 2)
Range("ACA10000").End(xlUp).Offset(1, 0) = Cells(j, 3)

    If Cells(j, i).Comment.Text <> "" Then
    Range("ACB10000").End(xlUp).Offset(1, 0) = Cells(j, i).Comment.Text
    Else
    Range("ACB10000").End(xlUp).Offset(1, 0) = "-"
    End If
End If

Next j

Next i
end sub

Sauf que cela ne fonctionne pas car la propriété comment n'est pas compatible avec cells mais uniquement avec range.

Je ne vois pas ce que je peux faire pour récupérer mon commentaire du coup.

Merci d'avance pour votre aide
 
comme ceci
VB:
Sub test()
    Dim i&, j&, t$
    i = 2: j = 1
    Set Commentaire = Feuil1.Cells(i, j).Comment
    If Not Commentaire Is Nothing Then
        t = "oui il y a un commentaire " & vbCrLf
        If Feuil1.Cells(i, j).Comment.Text <> "" Then
            MsgBox t & Feuil1.Cells(i, j).Comment.Text
        End If
    Else
        MsgBox "non pas de commentaire "
    End If
End Sub
 
comme ceci
VB:
Sub test()
    Dim i&, j&, t$
    i = 2: j = 1
    Set Commentaire = Feuil1.Cells(i, j).Comment
    If Not Commentaire Is Nothing Then
        t = "oui il y a un commentaire " & vbCrLf
        If Feuil1.Cells(i, j).Comment.Text <> "" Then
            MsgBox t & Feuil1.Cells(i, j).Comment.Text
        End If
    Else
        MsgBox "non pas de commentaire "
    End If
End Sub
Ah super et bien merci beaucoup je vais mettre ça en application....

Bonne fin de journée
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

  • Question Question
XL 2021 VBA excel
Réponses
4
Affichages
68
Réponses
3
Affichages
586
Réponses
10
Affichages
725
  • Question Question
Microsoft 365 Export données
Réponses
4
Affichages
497
Réponses
4
Affichages
355
Retour