M
Max
Need help for 2 modifications to the sub below
Within the selected range:
1. Empty cells or cells with formulas evaluating to "" (zero length null
strings) should not have any comments inserted.
2. For cells with existing comments prior to the sub's run, the cell results
are to be written as a new line below the text within the existing comments.
As-is the sub overwrites such cells with new comments.
Sub FormulaResultToComment()
'Joel .prog
For Each Cell In Selection
If Len(Cell.Formula) > 0 Then
If Cell.Comment Is Nothing Then
Cell.AddComment
End If
'Cell.Comment.Text Text:=Cell.Formula
Cell.Comment.Text Text:=Cell.Value
End If
Next Cell
End Sub
Thanks
Max
Within the selected range:
1. Empty cells or cells with formulas evaluating to "" (zero length null
strings) should not have any comments inserted.
2. For cells with existing comments prior to the sub's run, the cell results
are to be written as a new line below the text within the existing comments.
As-is the sub overwrites such cells with new comments.
Sub FormulaResultToComment()
'Joel .prog
For Each Cell In Selection
If Len(Cell.Formula) > 0 Then
If Cell.Comment Is Nothing Then
Cell.AddComment
End If
'Cell.Comment.Text Text:=Cell.Formula
Cell.Comment.Text Text:=Cell.Value
End If
Next Cell
End Sub
Thanks
Max