+ Reply to Thread
Results 1 to 17 of 17

Macro for comments

  1. #1
    Registered User
    Join Date
    05-31-2018
    Location
    Bulgaria
    MS-Off Ver
    MS Office 2016
    Posts
    9

    Macro for comments

    Hello guys. I need little help with a macro I am trying to create. I need it to add a comment on ActiveCell, then to Paste in the comment my clipboard then to close the Comment box. When I record a macro, I am able to do all of this except the "Paste part".

    For example this is my macro

    Please Login or Register  to view this content.
    I just need this in red (ASDQWE) to be from my clipboard. When I copy something new just to paste it to the new cell I want to add a comment. Thanks
    Last edited by repsich; 05-31-2018 at 04:10 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro for comments

    Sorry Komusu

    Welcome but no one can help you because:-


    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Macro for comments

    Untested, but give this a try:

    Please Login or Register  to view this content.
    keep in mind that your code is not removing existing comments, and will error out if the cell has a comment already.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  4. #4
    Registered User
    Join Date
    05-31-2018
    Location
    Bulgaria
    MS-Off Ver
    MS Office 2016
    Posts
    9

    Re: Macro for comments

    Yes, I tried on empty cells but I get this: We looked at all the data next to your selection and didn't see a pattern for filling in values for you.
    Last edited by repsich; 06-01-2018 at 02:46 AM.

  5. #5
    Registered User
    Join Date
    05-31-2018
    Location
    Bulgaria
    MS-Off Ver
    MS Office 2016
    Posts
    9

    Re: Macro for comments

    Any thoughts guys ?

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Macro for comments

    That sounds like a Flash Fill message to me, unrelated to the code for comments.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  7. #7
    Registered User
    Join Date
    05-31-2018
    Location
    Bulgaria
    MS-Off Ver
    MS Office 2016
    Posts
    9
    Yes, but that I get when I use this second code.

  8. #8
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Macro for comments

    So you just run Arkadi's code exactly as posted and that error occurs?

  9. #9
    Registered User
    Join Date
    05-31-2018
    Location
    Bulgaria
    MS-Off Ver
    MS Office 2016
    Posts
    9
    Quote Originally Posted by xlnitwit View Post
    So you just run Arkadi's code exactly as posted and that error occurs?
    Yes, that's right.

  10. #10
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Macro for comments

    I don't currently have access to a version of Excel with Flash Fill to test, but I genuinely cannot see how that code could trigger it.

  11. #11
    Registered User
    Join Date
    05-31-2018
    Location
    Bulgaria
    MS-Off Ver
    MS Office 2016
    Posts
    9

    Re: Macro for comments

    It worked, I tried it on different excel and it worked. Thanks. I have one more question.
    Is it possible to paste my clipboard but after "Author" before every comment, it will be the same for every comment, just the clipboard will be different. It will be like in the code "& "tm"" but before mystring. Thanks so much

    Something like this
    Please Login or Register  to view this content.
    Edit:

    Please Login or Register  to view this content.
    I used this code it worked fine, but when I closed excel and open it again, the macro wasn't there and when I create the same macro I get this error "user-defined type not defined"

    Help please
    Last edited by repsich; 06-01-2018 at 07:03 AM.

  12. #12
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Macro for comments

    Quite possibly you had a userform in the original file, and not when you made the new one. I overlooked the fact that on a new book, you need to add a reference for this to work.

    In VBA Editor, Click on Tools, then References... and put a checkmark in the box next to Microsoft Forms 2.0 Object Library... then the error about user-defined type not defined will go away.

  13. #13
    Registered User
    Join Date
    05-31-2018
    Location
    Bulgaria
    MS-Off Ver
    MS Office 2016
    Posts
    9

    Re: Macro for comments

    Quote Originally Posted by Arkadi View Post
    Quite possibly you had a userform in the original file, and not when you made the new one. I overlooked the fact that on a new book, you need to add a reference for this to work.

    In VBA Editor, Click on Tools, then References... and put a checkmark in the box next to Microsoft Forms 2.0 Object Library... then the error about user-defined type not defined will go away.
    Thanks for reply, but I am not able to find Microsoft Forms 2.0 Object library in References

    Edit: Somehow i added it after I click insert user form and closed it because I didn't know what to do. And then I saw it's in references and now the code it's working.
    Last edited by repsich; 06-01-2018 at 07:50 AM.

  14. #14
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Macro for comments

    Insert a userform and then delete. That's the quickest way to add the reference. Alternatively, you can late bind the code so that you don't require the reference at all.

  15. #15
    Registered User
    Join Date
    05-31-2018
    Location
    Bulgaria
    MS-Off Ver
    MS Office 2016
    Posts
    9

    Re: Macro for comments

    How I can do it easy as possible, and add it to excel, not to every new document separately. Thanks

  16. #16
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Macro for comments

    Replace the first two lines with these
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    05-31-2018
    Location
    Bulgaria
    MS-Off Ver
    MS Office 2016
    Posts
    9

    Re: Macro for comments

    Thanks guys, very much !

+ 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. Comments Creator Macro
    By RN12345 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-19-2015, 01:26 AM
  2. [SOLVED] Comments Box Macro Help
    By liquidmettle in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-25-2014, 12:04 PM
  3. Cell Comments Macro
    By Kevin Stewart in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2014, 06:32 PM
  4. Macro to add comments
    By golclub in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2011, 03:08 AM
  5. Replies: 3
    Last Post: 08-14-2009, 07:22 AM
  6. Macro to Add Comments with vlookup
    By AllenWatts in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2006, 02:43 PM
  7. 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