Hello Roberto, works like a charm:) I just have one additional question. How can I define the target range on a separate sheet.
Example: Sheet1 = source range Sheet2 = target range And to make the matter even harder, the target range is transposed, so if source = a1:a10, target range = a1:j1 Thank you very much. This is a lifesavior for me. And I would be very grateful if someone could explain how to attach a sample workbook or any file for that matter. I don't see any option for that. regards, seba On 26 jan., 17:12, roberto mensa <robb....@gmail.com> wrote: > try > > Sub test() > Dim rng As Excel.Range > Dim v As Excel.Range > Set rng = [a1:a10] > For Each v In rng > write_comment v.Offset(, 1), v > Next > End Sub > Sub write_comment(rngc As Excel.Range, rngt As Excel.Range) > If TypeName(rngc.Comment) = "Nothing" Then > rngc.AddComment.Text > End If > rngc.Comment.Text CStr(rngt.Value) > End Sub > regards > r > > 2011/1/26 Seba <sebastjan.hri...@gmail.com> > > > Hello, > > > I recorded a macro which adds content from certain range of cells to > > another range of cells. Each cell serves as a content source for the > > target cell comment. > > > My problem is this. The source content is added periodically and if I > > trigger the macro for the second time, when I add source content to > > another source cell, I get this error: > > 'Run-time error 1004' > > Application defined or object defined error > > > I suppose macro should be adapted in a way, that all content is > > cleared and added again or something like that... > > > Here is the test macro: > > > -------------------------------------------------------------------------- > > Sub komentar() > > ' > > ' komentar Makro > > ' > > > ' > > Range("F14").Select > > Range("F14").AddComment > > Range("F14").Comment.Visible = True > > Range("F14").Comment.Text Text:="User:" & Chr(10) & "" > > Range("F20").Select > > Selection.Copy > > Range("F14").Comment.Shape.Select True > > Application.CutCopyMode = False > > Range("F14").Comment.Text Text:="User:" & Chr(10) & "" > > Range("F20").Select > > ActiveCell.FormulaR1C1 = "asdasda" > > Range("F14").Comment.Shape.Select True > > Range("F14").Comment.Text Text:="User:" & Chr(10) & "asdasda" > > Range("G21").Select > > End Sub > > > -------------------------------------------------------------------------------------- > > > Could anyone please help? > > > regards, > > > seba > > > -- > > > ---------------------------------------------------------------------------------- > > Some important links for excel users: > > 1. Follow us on TWITTER for tips tricks and links : > >http://twitter.com/exceldailytip > > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310 > > 3. Excel tutorials athttp://www.excel-macros.blogspot.com > > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com > > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com > > > To post to this group, send email to excel-macros@googlegroups.com > > > <><><><><><><><><><><><><><><><><><><><><><> > > Like our page on facebook , Just follow below link > >http://www.facebook.com/discussexcel -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel