+ Reply to Thread
Results 1 to 7 of 7

Replace Specific text in a cell with a color

  1. #1
    Registered User
    Join Date
    09-29-2021
    Location
    India
    MS-Off Ver
    2016
    Posts
    12

    Replace Specific text in a cell with a color

    I want help with Excel VBA code

    I need a code which can replace specific word, for example "YES", in a single cell with red color of that same word, here "YES" with a red color. In addition, if this word repeats multiple times in a single cell, then it should replace all those words.

    For example,
    if Range("A1") has value "YES I am ok, How about you? YES, I am ok too."
    Then the replacement should be "YES I am ok, How about you? YES, I am ok too."

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,443

    Re: Replace Specific text in a cell with a color

    Hi, The following code should do ask you require.

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    09-29-2021
    Location
    India
    MS-Off Ver
    2016
    Posts
    12

    Re: Replace Specific text in a cell with a color

    Thank you very much!
    It is working perfectly.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Replace Specific text in a cell with a color

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, 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 all those who offered help.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Registered User
    Join Date
    09-16-2021
    Location
    hyderabad
    MS-Off Ver
    2019
    Posts
    20

    Re: Replace Specific text in a cell with a color

    hello,

    simply you can go with this,
    select you cells and go to "home" tab in that "clear" option click down arrow and click "clear formats"
    or
    simply change font color

    if it is helpful to you pls change as solved query
    Last edited by R Bramhendra; 09-29-2021 at 05:34 AM.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: Replace Specific text in a cell with a color

    @R Bramhendra

    I don't think you have understood the requirement at all. The OP wants certain words in the text formatting automatically (can only be done with VBA). How does clearing formats or changing a whole cell's font colour help? Well, it doesn't, sadly. Thanks for trying, though.

  7. #7
    Registered User
    Join Date
    09-16-2021
    Location
    hyderabad
    MS-Off Ver
    2019
    Posts
    20

    Re: Replace Specific text in a cell with a color

    i have though like that way

    its ok mam

+ 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. Color specific text within a cell
    By Vermeil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-06-2019, 04:21 AM
  2. How to find replace or change specific text color in a range
    By faizzsheikh in forum Excel General
    Replies: 7
    Last Post: 09-08-2016, 01:53 PM
  3. Replies: 1
    Last Post: 07-20-2016, 10:12 AM
  4. Replace blank cell or cell with one character with specific text
    By shaz0503 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-15-2015, 12:57 AM
  5. Replacing specific text in a cell by row and replace with text in another row
    By merQrey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-23-2014, 10:05 AM
  6. Replies: 0
    Last Post: 03-12-2013, 04:29 PM
  7. Advanced find and replace specific text within a cell
    By visionwindowfilms in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-14-2011, 04:28 AM

Tags for this Thread

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