+ Reply to Thread
Results 1 to 8 of 8

Highlight a portion of string text (the string text is a value of a formula)

  1. #1
    Registered User
    Join Date
    08-01-2012
    Location
    Bandung, Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Highlight a portion of string text (the string text is a value of a formula)

    I know from several thread that this thing is possible, but there is none of the thread that i search meet my problem exactly.
    so here is my problem :

    Let's say i have a formula in cell A1 which have a value "The red big apple eaten by a red worm"
    could anyone suggest a macro to make the text "red" in that cell become highlighted?
    and if it possible i need that macro always automatically work whenever the workbook opened and for everytime I type "red", it will automatically highlighted red without I must manually run the macro.

    Thanks you very much for help me

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

    Re: Highlight a portion of string text (the string text is a value of a formula)

    You can not format the cell partially when the contents of the cell is either formula or number.

    You will need to convert the cell to the constant, so that you can do the thing.

    e.g
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-01-2012
    Location
    Bandung, Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Highlight a portion of string text (the string text is a value of a formula)

    Hi jindon,

    Thank you so much for your solution. This exactly what i want except, the code you suggest only highlight the first "red" in the text, but the second "red" in that text doesn't red highlighted.
    also, can you tell me how to make the code always run in a selected range. (I want to make whenever I open the file, it will automatically run)

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

    Re: Highlight a portion of string text (the string text is a value of a formula)

    Try
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-01-2012
    Location
    Bandung, Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Highlight a portion of string text (the string text is a value of a formula)

    Marvelous jindon, you are the best!
    Last question, if i want to enhance the code so it can highlight more than one type, can you make the code for me, please?
    Let's say i want to make "red" and "apple" become highlighted in text "I want big red apple from the red apple tree"

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

    Re: Highlight a portion of string text (the string text is a value of a formula)

    Change pattern to
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    08-01-2012
    Location
    Bandung, Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Highlight a portion of string text (the string text is a value of a formula)

    Thank you again jindon!
    you really solve my problem

    cheers

  8. #8
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Highlight a portion of string text (the string text is a value of a formula)

    @ RaymondH

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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