Macro to convert range of Cells to Comments?


Posted by Mike Pool on May 15, 2001 12:19 PM

Does anyone have a Macro, or know of other means, by which to convert the data in a cell into a comment within that same cell? Better yet, to do the same for a range of cells?

Thanks.

Posted by Dax on May 15, 2001 1:22 PM

Hi,
Something like this will add comments to all cells in the selected range with the comment being the same as the cell value.

Sub ChangeValuesToComments()
Dim rnge As Range, r As Long, c As Integer
Set rnge = Selection
rnge.ClearComments

For r = 1 To rnge.Rows.Count
For c = 1 To rnge.Columns.Count
With rnge.Cells(r, c).AddComment
.Text (rnge.Cells(r, c).Value) & ""
.Visible = False
End With
Next c
Next r
End Sub

HTH,
Dax.



Posted by Mike Pool on May 15, 2001 2:35 PM

Works great, I knew I came to the right place....Thanks Dax!

Mike