+ Reply to Thread
Results 1 to 9 of 9

Macro to insert cell comments from a list in another sheet

  1. #1
    Registered User
    Join Date
    02-26-2015
    Location
    Bucharest, Romania
    MS-Off Ver
    2010
    Posts
    6

    Question Macro to insert cell comments from a list in another sheet

    Hello!

    I am a beginner in using VBA code, so I am not very good at writing new macros. I would really apreciate any help of yours.
    Does anyone know how can I insert cell comments on a range of cells existing on a sheet, comments that should be taken from another range of cells which is on another sheet.
    I mean, more specific: I have Sheet1 that contains range A1:A200 with different text values in cells and I have Sheet2 where I'd like to insert comments on A1:YYY1 containing data in previously named range. These comments must be also transposed. Is there a possibility to do this? Thank you so much.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Macro to insert cell comments from a list in another sheet

    Hello,

    To take the contents of A1:A200 on sheet1 and place them in the comments of Sheet2 A1:GR1

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    02-26-2015
    Location
    Bucharest, Romania
    MS-Off Ver
    2010
    Posts
    6

    Re: Macro to insert cell comments from a list in another sheet

    Thank you so much. It works fine.
    But what about if I don't know the range from sheet1? I have to use this macro for several workbooks and they have different ranges...so I'd like it to be more general.

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Macro to insert cell comments from a list in another sheet

    Assuming the size of the range will be driven from the first sheet, and it starts at A1,

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-26-2015
    Location
    Bucharest, Romania
    MS-Off Ver
    2010
    Posts
    6

    Re: Macro to insert cell comments from a list in another sheet

    One more question. What if the first cell on sheet1 with text is A4? I am trying to figure it out, but I have an error.

  6. #6
    Registered User
    Join Date
    02-26-2015
    Location
    Bucharest, Romania
    MS-Off Ver
    2010
    Posts
    6

    Re: Macro to insert cell comments from a list in another sheet

    I tried this, but it return error 400. Obiouvsly, I am doing something wrong.

    Sub Com()

    Dim iCount1 As Integer, iMax As Integer, iCount2 As Integer
    iMax1 = Range("I" & Rows.Count).End(xlUp).Row
    iMax2 = Range(Columns.Count & "1").End(xlUp).Column
    On Error Resume Next
    For iCount1 = 1 To iMax2
    For iCount2 = 4 To iMax1
    Sheets("S2").Cells(1, iCount1).AddComment Sheets("S2").Cells(iCount2, 1).Value
    Next
    Next
    End Sub

  7. #7
    Registered User
    Join Date
    02-26-2015
    Location
    Bucharest, Romania
    MS-Off Ver
    2010
    Posts
    6

    Re: Macro to insert cell comments from a list in another sheet

    I solved it. The 2 "for" iterations were a very bad idea because I realised later it wasn't what I needed.

    Thank you so much for your help.

    Have a nice day!

  8. #8
    Registered User
    Join Date
    02-26-2015
    Location
    Bucharest, Romania
    MS-Off Ver
    2010
    Posts
    6

    Re: Macro to insert cell comments from a list in another sheet

    I'd like to know one more think. How do I run this macro from another workbook? It doesn't work for another one.

  9. #9
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Macro to insert cell comments from a list in another sheet

    You can either store the code in the alternate workbook or store the code in an addin that loads as you start excel.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Transfer comments from Sheet 1 to Sheet 2 as list
    By Welshandproud1 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-16-2014, 06:52 AM
  2. Macro to insert comments containing contenet of different cells
    By momo19 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-22-2013, 09:48 AM
  3. Excel macro to check for certain rules and insert comments on a cell
    By anogueira.igate in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-16-2012, 07:37 AM
  4. Macro to insert comments and get data from cells
    By Picco in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2012, 03:28 AM
  5. macro to insert comments?
    By darkwood in forum Excel General
    Replies: 5
    Last Post: 01-31-2006, 04:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1