Hej,
kod bez formatowania przetwarzanych komentarzy:
Sub OpracujKomentarze()
Dim w As Long, wMax As Long
Dim rgB As Range, rgA As Range
With ActiveSheet.UsedRange
wMax = .Row + .Rows.Count
End With
For w = 1 To wMax
Set rgB = Cells(w, "B")
'jeżeli nie jest prawdą, że obiekt 'komentarz' nie istnieje
'czyli jeśli jest komentarz
If Not rgB.Comment Is Nothing Then
Set rgA = Cells(w, "A")
If rgA.Comment Is Nothing Then
'wstaw komentarz
rgA.AddComment rgB.Comment.Text
Else
'dodaj komentarze
rgA.Comment.Text rgA.Comment.Text & Chr(10) & _
rgB.Comment.Text
End If
'ustaw automatyczny rozmiar komentarza
rgA.Comment.Shape.TextFrame.AutoSize = True
'usuń komentarz
rgB.ClearComments
End If
Next w
End Sub |