+ Reply to Thread
Results 1 to 10 of 10

Coloring certain words in strings based on list....?

  1. #1
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Coloring certain words in strings based on list....?

    Hi

    I have a column B with a lot of text strings (of varying length) beginning in B2. In the first row C1 to "??"1, I have a list of words or "word*", that I would like to give a color in the text strings. Only these words should get colors, not the whole cell. As a start they could just get the same color, at some point, though, it would be very cool if they could also get different colors..

    Is this at all possible?

    Jacob

  2. #2
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Coloring certain words in strings based on list....?

    Based on code from this thread:http://www.excelforum.com/excel-gene...html?p=2963260
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Coloring certain words in strings based on list....?

    Wow, cool...
    One thing, though. Is it possible to let the macro use wild cards?
    To stay within the example from the sheet you attached:

    Cat is colored red, but what if the keyword mouse was mou* instead, and alle words containing mou should be green, not just mouse.

  4. #4
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Coloring certain words in strings based on list....?

    .........double post, sorry.............

  5. #5
    Valued Forum Contributor
    Join Date
    07-29-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    534

    Re: Coloring certain words in strings based on list....?

    I suppose the Regex part of the macro would have to be re-written, but that's beyond my skills.

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

    Re: Coloring certain words in strings based on list....?

    Replace the entire code with
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Coloring certain words in strings based on list....?

    Hi jindon, WHER or anyone else

    just a follow up question. Say I would like to not only color the word, but also make it Bold, where should the code be changed?

    J

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

    Re: Coloring certain words in strings based on list....?

    change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Coloring certain words in strings based on list....?

    Thank you..!

  10. #10
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Coloring certain words in strings based on list....?

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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