Closed Thread
Results 1 to 16 of 16

Highlight text only(not cell) in a certain color

  1. #1
    Registered User
    Join Date
    08-16-2012
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    3

    Question Highlight text only(not cell) in a certain color

    Hi,

    If a cell contains the words, Hat, Bat, Cat, Mouse, I would like the work Cat to be highlighted in Red, and Mouse in Blue and not the cell to be highlighted.


    Appreciate your help.

    Jay

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Highlight text only(not cell) in a certain color

    You can use conditional formatting to apply any format, including text color, to cells based on their value.

    It is in the Styles section on the Home tab on the ribbon

  3. #3
    Registered User
    Join Date
    08-16-2012
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Highlight text only(not cell) in a certain color

    Hi,

    Thanks for the response. I tried Conditional Formatting prior to reaching out to folks in the forum but the results seemed to cater to the overall cell and not a specific text.

    Pardon my ignorance, but do you mind walking me through the process wrt highlighting the text value only?

    Thank You
    Jay

  4. #4
    Forum Contributor
    Join Date
    04-29-2010
    Location
    Tallahassee, FL
    MS-Off Ver
    365
    Posts
    100

    Re: Highlight text only(not cell) in a certain color

    The attached screenshot was achieved by using conditional formatting in Excel 2007. Is this what you are looking for?
    Attached Images Attached Images

  5. #5
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Highlight text only(not cell) in a certain color

    If all of those words are in the same cell, the only way I know to have multiple font colors in the same cell is a manual process where you highlight each word individually and then apply the color you want. I also recorded a macro to see the steps involved in changing the color for specific characters and it provide a good starting point if you want to chase the VBA route.
    Last edited by Pauleyb; 10-05-2012 at 05:02 PM.
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  6. #6
    Forum Contributor
    Join Date
    04-29-2010
    Location
    Tallahassee, FL
    MS-Off Ver
    365
    Posts
    100

    Re: Highlight text only(not cell) in a certain color

    Quote Originally Posted by Pauleyb View Post
    If all of those words are in the same cell, the only way I know to have multiple font colors in the same cell is a manual process where you highlight each word individually and then apply the color you want. I will assume there is a VBA method, too.

    Sorry about that. I need to work on my reading comprehension skills.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Highlight text only(not cell) in a certain color

    when you apply CF, instead if clicking on "fill", select "font" normally the default tab, then apply your FC using font colors as if you wewre doing fill instead
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  8. #8
    Registered User
    Join Date
    08-16-2012
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Highlight text only(not cell) in a certain color

    Thanks for all your inputs.

    Pauleyb, a working macro sounds great! Could you please provide the macro?


    Best,
    Jay

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

    Re: Highlight text only(not cell) in a certain color

    If vba then
    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    04-29-2010
    Location
    Tallahassee, FL
    MS-Off Ver
    365
    Posts
    100

    Re: Highlight text only(not cell) in a certain color

    Jindon, that is absolutely COOL.

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

    Re: Highlight text only(not cell) in a certain color

    Quote Originally Posted by Royzer View Post
    Jindon, that is absolutely COOL.
    Thanks and glad you like it.

  12. #12
    Registered User
    Join Date
    01-23-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Highlight text only(not cell) in a certain color

    Digging up an old thread, but this proved very useful for me.

    Had to edit the line:

    Please Login or Register  to view this content.
    To get it to work correctly for me. Changed the Range to suit the column I was using, in this case "A1" to "K1" and "a" to "k"


    Thanks

  13. #13
    Registered User
    Join Date
    01-27-2014
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Highlight text only(not cell) in a certain color

    I have the same question as jayanthi_d originally had. I need to highlight a word in a cell - not change the font color of a word in a cell. The responses all seem to be related to how to change the font color versus highlighting a word in a cell. Is there a way to do this? Thanks!

  14. #14
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Highlight text only(not cell) in a certain color

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

  15. #15
    Registered User
    Join Date
    01-27-2014
    Location
    New York, USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Highlight text only(not cell) in a certain color

    Sorry for the error. I will create a new post and refer back to this one.

  16. #16
    Registered User
    Join Date
    05-02-2014
    Location
    orange county, california
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Highlight text only(not cell) in a certain color

    Hi,

    i liked your VBA code and i am trying to use it for a project at work. i was playing around with your example, the Cat_Mouse.xlsm, and when i modified the 'myList' and 'myColor' arrays, it does not work.


    for exmaple, i changed myList to = VBA.Array("Cat", "Mouse", "bat")
    myColor = VBA.Array(vbRed, vbBlue, vbRed)

    but the word "Bat" is not colored red. interestingly enough, when i substitute the word "bat" for the word "hat", the word "hat" does change to the red font. any ideas?

    i am looking to use this code to address keywords in my excel file by coloring all key words red and i have more than 10 key words.

Closed 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