Hi all and a Happy New Year!!
I have a question for those who are online. I am trying to add comments in a selection of cells and where there is a value then the comment should show the formula value of the cell ie if the formula in cell A1 is = 9 + 10 then the comment should show this. This I have got to work, but if I have a comment already the macro fails and I have tried to get round this but I am not clever enough :(. Can anyone see what I am doing wrong?
Sub InsertingComments() Dim r As Range For Each r In Selection If r.Comment = True Then r.AddComment = False End If If r.Value <> "" Then r.Select r.AddComment r.Comment.Visible = False r.Comment.Text Text:=ActiveCell.Formula End If Next r End Sub