XL 2010 Récupérer commentaire des cellules

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
 

patricktoulon

XLDnaute Barbatruc
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
 

Airone784

XLDnaute Occasionnel
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
 

Discussions similaires

Réponses
12
Affichages
537

Statistiques des forums

Discussions
311 713
Messages
2 081 806
Membres
101 819
dernier inscrit
lukumubarth