+ Reply to Thread
Results 1 to 18 of 18

VBA match and add comment macro amendment

  1. #1
    Registered User
    Join Date
    02-24-2017
    Location
    France
    MS-Off Ver
    2007
    Posts
    86

    VBA match and add comment macro amendment

    Hi, I have a macro, which I would like to amend slightly. Right now, it's lopping through column P and providing comments in column T, IF:

    1. Same value exists more than once
    2. There's a specific value in column next to P.

    I would like the macro to do the same procedure, but provide comments in column T, only if in column P there are also cells with other values than those in my code.

    So for instance if in column P:

    1. Same value occurs multiple times
    2. It's value in column P equals to either "Triggered" or "Periodic"
    3. AND there's the other string in column P for the same value
    4. There's a comment in column T.


    Please Login or Register  to view this content.
    Many thanks for your help.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA match and add comment macro amendment

    Hi bizzarofen

    Uploading a sample workbook could get you the result you require for this Thread.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: VBA match and add comment macro amendment

    Quote Originally Posted by bizzarofen View Post
    ... in column P there are also cells with other values than those in my code.

    So for instance if in column P:

    1. Same value occurs multiple times
    2. It's value in column P equals to either "Triggered" or "Periodic"
    3. AND there's the other string in column P for the same value
    4. There's a comment in column T.
    Your references to "value" and "values" are vague. Are values in some column other than P being examined?
    What does "AND there's the other string in column P for the same value" mean?

  4. #4
    Registered User
    Join Date
    02-24-2017
    Location
    France
    MS-Off Ver
    2007
    Posts
    86

    Re: VBA match and add comment macro amendment

    Hi sintek, I am attaching a sample workbook with my data.

    @leelnich - Sorry for the confusion, I indeed explained it badly, so let me explain in more detail. Macro is based on values in column P and column I. With regards to your second question - macro is at first looking for duplicates in column P and then based on the values in column P, it's adding a comment in column T.
    I would like to slightly improve the macro so it will work like this:


    1. Same value occurs multiple times in column P
    2. AND value in column I equals to either "Triggered" or "Periodic"
    3. AND there's also the other string in column I
    4. Add a comment in column T.

    Hope I managed to explained it better now.

  5. #5
    Registered User
    Join Date
    02-24-2017
    Location
    France
    MS-Off Ver
    2007
    Posts
    86

    Re: VBA match and add comment macro amendment

    Attaching the file.
    Attached Files Attached Files

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA match and add comment macro amendment

    AND there's also the other string in column I
    What other string?

  7. #7
    Registered User
    Join Date
    02-24-2017
    Location
    France
    MS-Off Ver
    2007
    Posts
    86

    Re: VBA match and add comment macro amendment

    String, which is different than "Periodic" or "Triggered"

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA match and add comment macro amendment

    Meaning "New" & "Remediation"

  9. #9
    Registered User
    Join Date
    02-24-2017
    Location
    France
    MS-Off Ver
    2007
    Posts
    86

    Re: VBA match and add comment macro amendment

    In that case. Ideally, macro will include also other statuses if I were to add some.

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA match and add comment macro amendment

    K so let me try understand this;
    If the same value occurs multiple times in column P
    And If Column I contains either "New, Periodic, Triggered, remediation or anything else then Put 'Published" in Column T?

  11. #11
    Registered User
    Join Date
    02-24-2017
    Location
    France
    MS-Off Ver
    2007
    Posts
    86

    Re: VBA match and add comment macro amendment

    I think we're on the same page here, so just to put it in more detail:

    If the same value occurs multiple times in column P
    And If Column I contains either "Periodic, Triggered" AND in the same time there are also other string than "Periodic, Triggered" in column I for the same multiple values in column P then Put 'Published" in Column T?

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: VBA match and add comment macro amendment

    K and last question....must the word "Published" be in column t for all the matched rows.

  13. #13
    Registered User
    Join Date
    02-24-2017
    Location
    France
    MS-Off Ver
    2007
    Posts
    86

    Re: VBA match and add comment macro amendment

    It'll be perfect if this comment will be added for the matched rows, but there might be also marking rows in different color, in case that's easier to be amended.

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: VBA match and add comment macro amendment

    This should do
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    02-24-2017
    Location
    France
    MS-Off Ver
    2007
    Posts
    86

    Re: VBA match and add comment macro amendment

    Hi jindon, many thanks for your help, this macro is just astonishing. Will it be possible to add " Non-published" comment in col T in a situation when there is a match , but the values are not "Triggered", "Periodic"?

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: VBA match and add comment macro amendment

    Not really sure though...
    Please Login or Register  to view this content.

  17. #17
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: VBA match and add comment macro amendment

    Or this
    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    02-24-2017
    Location
    France
    MS-Off Ver
    2007
    Posts
    86

    Re: VBA match and add comment macro amendment

    Thank you so much jindon, that's just perfect!

+ 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. Code amendment request to insert an image to match name of person
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-05-2016, 01:54 AM
  2. Need an amendment in a macro which records system time.
    By Raju Radhakrishnan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-19-2013, 12:02 AM
  3. Amendment to a working Macro
    By SilverFox in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-22-2012, 11:01 AM
  4. [SOLVED] Macro needs amendment to include loop
    By Marcel747400 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-17-2012, 07:38 AM
  5. Amendment to Matching Macro
    By somesoldiers in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2011, 11:25 AM
  6. macro amendment so that it loops
    By mattbloke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2010, 02:47 AM
  7. Amendment to macro so that it loops (comparison of dates)
    By mattbloke in forum Excel General
    Replies: 1
    Last Post: 08-12-2010, 05:38 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