Hi
I would like to add comments to column A and use the text that is in column B. The problem is I get an error message if there is already a comment to a cell in column A. How can I rewrite my code so that it will not try to add a comment and just replace the text that was already there? (I get a run-time error and it highlights the AddComment line).
Sub ILuvComments()
lastrow = Range("B" & Rows.Count).End(xlUp).Row
For i = 1 To lastrow
Range("A" & i).AddComment
Range("A" & i).Comment.Text Text:=Range("B" & i).Value
Next i
End Sub
I would like to add comments to column A and use the text that is in column B. The problem is I get an error message if there is already a comment to a cell in column A. How can I rewrite my code so that it will not try to add a comment and just replace the text that was already there? (I get a run-time error and it highlights the AddComment line).
Sub ILuvComments()
lastrow = Range("B" & Rows.Count).End(xlUp).Row
For i = 1 To lastrow
Range("A" & i).AddComment
Range("A" & i).Comment.Text Text:=Range("B" & i).Value
Next i
End Sub