How to add comments to data from another worksheet column automatically using VBA.
When we add a comment to a worksheet cell or range, it displays a red triangle at the right top corner. When we hover over the cell with the mouse, the comment is displayed. We can now view, for example, the designation of an employee or the price of an item which is located in a far away worksheet cell. Watch the video below:
Here is the complete VBA code:
Option Explicit
Sub AddCommentFromAnotherColumn()
Dim counter As Long
Dim lastrow As Long
lastrow = Application.WorksheetFunction.CountA(Range(“A:A”))
‘MsgBox lastrow
For counter = 2 To lastrow
Cells(counter, 1).ClearComments
Next
For counter = 2 To lastrow
Range(“A” & counter).AddComment
Range(“A” & counter).Comment.Text Text:=Range(“Y” & counter).Value
Next
End Sub

Further Reading: