A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
OOPS,
Missed the bit about autosize, try this one.
Sub HasComment()
Dim mycomment As Object, LastRow As Long
Dim c As Range
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For Each c In Range("A2:A" & LastRow)
'Col A
Set mycomment = c.Comment
If mycomment Is Nothing Then
If Cells(c.Row, "XX") <> "" Then
c.AddComment
c.Comment.Text Cells(c.Row, "XX").Text
c.Comment.Shape.TextFrame.AutoSize = True
End If
Else
c.Comment.Delete
If Cells(c.Row, "XX") <> "" Then
c.AddComment
c.Comment.Text Cells(c.Row, "XX").Text
c.Comment.Shape.TextFrame.AutoSize = True
End If
End If
'Col B
Set mycomment = c.Offset(, 1).Comment
If mycomment Is Nothing Then
If Cells(c.Row, "XY") <> "" Then
c.Offset(, 1).AddComment
c.Offset(, 1).Comment.Text Cells(c.Row, "XY").Text
c.Offset(, 1).Comment.Shape.TextFrame.AutoSize = True
End If
Else
c.Offset(, 1).Comment.Delete
If Cells(c.Row, "XY") <> "" Then
c.Offset(, 1).AddComment
c.Offset(, 1).Comment.Text Cells(c.Row, "XY").Text
c.Offset(, 1).Comment.Shape.TextFrame.AutoSize = True
End If
End If
Next
End Sub