+ Reply to Thread
Results 1 to 12 of 12

Add coments VBA

  1. #1
    Registered User
    Join Date
    04-02-2020
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    80

    Add coments VBA

    Hi,
    I am trying to make a macro that insert automaticlly a comment if a cell match a certain condition. If there is a cell with the value "o" it should appear a comment box.
    So far I got this:
    Please Login or Register  to view this content.
    Can you help me ?

    thanks
    Attached Images Attached Images

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,609

    Re: Add coments VBA

    Please Login or Register  to view this content.
    If there are comments already you may for instance override adding by
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    04-02-2020
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    80

    Re: Add coments VBA

    Hi,
    thanks for your prompt reply, it returns me the following error in the capture attached

    Regards,
    Attached Images Attached Images

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,609

    Re: Add coments VBA

    I've shown only the middle part to be inserted in your code. The whole sub could read:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-02-2020
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    80

    Re: Add coments VBA

    where could be the mistake?
    Attached Images Attached Images

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Add coments VBA

    Check if the sheetname is correct then try this way.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Registered User
    Join Date
    04-02-2020
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    80

    Re: Add coments VBA

    Thanks guys,
    would there be some way to do it without having to run the macro every time? in the sense that every time an employee enters an "o" a new comment is automatically generated. Could be with an event like Worksheet_SelectionChange instead of sub?

  8. #8
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,609

    Re: Add coments VBA

    Yes, it could.

    But observing problems with the implementation - I'd strongly recommend following the hint from a yellow banner above.



    Anyway, let's try. The code for the Change event handler in a sheet (right click on the sheet name tab and select view code):

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    04-02-2020
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    80

    Re: Add coments VBA

    Thank you!!
    just one more point: it would be ideal to not show all the comments at the same time, just the one in the cell selected.
    This I know can be achieved writting: .Comment.Visible = False ,but in this way it does not allow me to edit the comment. I'd need both see the comment just in the selected cell and able to edit it.

    Would be target.comment.visible=true ?

    I attached you the template with the code this time.

    thanks a lot
    Attached Files Attached Files

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Add coments VBA

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    04-02-2020
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    80

    Re: Add coments VBA

    Amazing, thanks very much man

  12. #12
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Add coments VBA

    You're welcome and thanks for rep+.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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. Cell coments into Word
    By screetch in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-11-2007, 04:01 AM
  2. How do I ensure that the coments appear adjacent to the cell
    By A.RAGHUNATH in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-07-2006, 08:40 AM
  3. Can I change Indacator coments color?
    By Monica in forum Excel General
    Replies: 2
    Last Post: 02-16-2006, 05:10 PM
  4. Coments
    By Horacio in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-22-2005, 09:30 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