Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB Code to Add Comments to Cells from Several Other Cells
Need to add comments with a macro or VB code. Want to collect the
contents of several other cells, add them together as a text string and then put them into a particular cell as a comment. For example, I want to add comments to cells a1:a5 in Sheet1. Sheet2 contains the data I want to include in the comments in cells a1:c5. The comment for cell a1 in Sheet1 needs to include the contents of cells a1:c1 from Sheet2. Comment for a2 in Sheet1 comes from cells a2:c2. Thanks for any suggestions or sample code. Mark |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB Code to Add Comments to Cells from Several Other Cells
Sub Addcomments()
Dim sh1 As Worksheet Dim sh2 As Worksheet Set sh1 = Worksheets("sheet1") Set sh2 = Worksheets("sheet2") Dim cell As Range For Each cell In sh1.Range("A1:A5") On Error Resume Next cell.Comment.Delete On Error GoTo 0 cell.AddComment Text:=sh2.Cells(cell.Row, 1) & _ " " & sh2.Cells(cell.Row, 2) & " " & _ sh2.Cells(cell.Row, 3) Next End Sub -- Regards, Tom Ogilvy "Mark" wrote in message om... Need to add comments with a macro or VB code. Want to collect the contents of several other cells, add them together as a text string and then put them into a particular cell as a comment. For example, I want to add comments to cells a1:a5 in Sheet1. Sheet2 contains the data I want to include in the comments in cells a1:c5. The comment for cell a1 in Sheet1 needs to include the contents of cells a1:c1 from Sheet2. Comment for a2 in Sheet1 comes from cells a2:c2. Thanks for any suggestions or sample code. Mark |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I color code comments in cells on Excel spreadsheet? | Excel Worksheet Functions | |||
how to filter cells where are comments... | Excel Discussion (Misc queries) | |||
Hide cells with comments in them. | Excel Discussion (Misc queries) | |||
how can we copy cells comments text and paste to cells | Excel Discussion (Misc queries) | |||
Comments in cells | Excel Worksheet Functions |