+ Reply to Thread
Results 1 to 14 of 14

Adding Comment List using VBA

  1. #1
    Forum Contributor
    Join Date
    11-25-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    200

    Adding Comment List using VBA

    Below is the code I used to add a comment from text in another cell. I want the comment to pull from a range of cells so it shows up as a list. In the attached file, I want the comment to show I3 & I4 on separate lines. Thanks.


    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Adding Comment List using VBA

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,416

    Re: Adding Comment List using VBA

    Quote Originally Posted by AlphaFrog View Post
    Please Login or Register  to view this content.
    Since there are only two cells involved and their addresses are fixed, you should be able to use this in place of what I highlighted in red above as well...
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    11-25-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    200

    Re: Adding Comment List using VBA

    Thank you so much. Is there a way to have the comment auto-update if I3 & I4 change without re-running the macro?

  5. #5
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,416

    Re: Adding Comment List using VBA

    You can use event code instead of a macro. Here is the event code that will do it...
    Please Login or Register  to view this content.
    HOW TO INSTALL Event Code
    ------------------------------------
    If you are new to event code procedures, they are easy to install. To install it, right-click the name tab at the bottom of the worksheet that is to have the functionality to be provided by the event code (this is the worksheet with the cells I3 and I4 you are using to create your comment) and select "View Code" from the popup menu that appears. This will open up the code window for that worksheet. Copy/Paste the event code into that code window. That's it... the code will now operate automatically when its particular event procedure is raised by an action you take on the worksheet itself. Note... if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.

  6. #6
    Forum Contributor
    Join Date
    11-25-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    200

    Re: Adding Comment List using VBA

    OMG that is amazing. Thank you. I tried making a change for when the range is more than 2 cells, i.e. I3, I4, I5, & I6 and can't get it to work. How would I do that?

  7. #7
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,416

    Re: Adding Comment List using VBA

    Programs are written for the conditions given... what works for 2 cells may not work for more cells depending on what you are doing and how many cells are involved. So...

    How many cells are we talking about in total? A fixed number of cells you can give me address for? Or do you want all cells in Column I starting at Row 3?

    You may also want to consider the following which I have posted in the past..

    Please Note
    -------------------
    For future questions you may ask, please do not simplify your question for us... doing so will get you a great answer to a question you do not actually have and which you do not actually care about AND it will almost always lead to you coming back for help when the solution we give you for the simplified question cannot be applied to your actual data and its layout. One thing you must keep in mind when you ask a question in a forum... the people you are asking to help you know absolutely nothing about your data, absolutely nothing about how it is laid out in the workbook, absolutely nothing about what you want done with it and absolutely nothing about how whatever it is you want done is to be presented back to you as a result... you must be very specific about describing each of these areas, in detail, and you should not assume that we will be able to "figure it out" on our own. Remember, you are asking us for help... so help us to be able to help you by providing the information we need to do so, even if that information seems "obvious" to you (remember, it is only obvious to you because of your familiarity with your data). To sum up... we only know what you tell us, nothing more.

  8. #8
    Forum Contributor
    Join Date
    11-25-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    200

    Re: Adding Comment List using VBA

    I understand that and I apologize for not being more specific. It would be a fixed 5 cells all in a column (I1, I2, I3, I4, I5), but not the entire column. But what I really need to do is to have those source cells (I1-I5) be on a different sheet and it can be called "source". Are you able to help with that? Thanks again.

  9. #9
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,416

    Re: Adding Comment List using VBA

    It doesn't matter what the different sheet's name is... you must install the code in whatever sheet's code module which you bring up by right-clicking that specific sheet's tab and selecting "View Code" from the popup menu that appears. Here is the revised code to handle cells I1:I5 on that source sheet (combined text will be written to cell C3 on the sheet named "oem price discounted")...
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    11-25-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    200

    Re: Adding Comment List using VBA

    Thank you. I am sorry but I meant the the source cells (i1-I5) will be on a separate sheet (source) than the cell which I need the comment in C3 to appear. This needed C3 cell will reside in "OEM Price Discounted".

  11. #11
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,416

    Re: Adding Comment List using VBA

    Quote Originally Posted by backyardfun View Post
    I am sorry but I meant the the source cells (i1-I5) will be on a separate sheet (source) than the cell which I need the comment in C3 to appear. This needed C3 cell will reside in "OEM Price Discounted".
    I know... the code I gave you does that. To repeat, right click the tab that contains your I1 to I5 cells, select "View Code" from the popup menu and copy paste the last code I posted into the code window that appears. Everything will work automatically after that.

  12. #12
    Registered User
    Join Date
    09-01-2018
    Location
    USA
    MS-Off Ver
    365
    Posts
    96

    Re: Adding Comment List using VBA

    Just replace below line
    Please Login or Register  to view this content.
    with this
    Please Login or Register  to view this content.

  13. #13
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,416

    Re: Adding Comment List using VBA

    @AC PORTA VIA,

    That in not necessary to do... the code is event code and, as such, must be installed in the Source worksheet code module where all unreferenced cells will automatically default to the Source worksheet since events can only take place on active worksheets (the Source worksheet will be the active worksheet when cells I1 thru I5 are changed by the user).
    Last edited by Rick Rothstein; 01-29-2021 at 09:42 PM.

  14. #14
    Forum Contributor
    Join Date
    11-25-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    200

    Re: Adding Comment List using VBA

    Thank you Rick. One last thing. I need to have multiple cells on the same sheet have their comments auto-generated from other multiple source cells. I have tried this and it is not working. Thanks in advance.

    Please Login or Register  to view this content.

+ 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. [SOLVED] Adding Comment using VBA
    By backyardfun in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-28-2021, 04:04 PM
  2. [SOLVED] Adding Comment using VBA
    By backyardfun in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2021, 03:45 PM
  3. Adding comment to cell
    By Dunenewt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-13-2015, 10:54 AM
  4. Adding a Comment Box
    By clpickett3 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-02-2015, 06:37 PM
  5. Disable Delete Comment, Edit Comment, Show/Hide Comment
    By Shanthan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2013, 06:12 AM
  6. adding comment to cell
    By mancitmis in forum Excel General
    Replies: 1
    Last Post: 11-02-2005, 11:15 AM
  7. Adding a new comment with a function?
    By Cheese in forum Excel General
    Replies: 4
    Last Post: 07-31-2005, 07:05 AM

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