+ Reply to Thread
Results 1 to 10 of 10

Highlighting specific letters in a cell with different colours

  1. #1
    Registered User
    Join Date
    05-29-2020
    Location
    london, england
    MS-Off Ver
    365
    Posts
    4

    Highlighting specific letters in a cell with different colours

    Hi,

    I am new to the forum, and am looking for advice and guidance on a method for highlighting specific letters and letter combinations in a cell with a large number of letters for scientific research. I have attached an example excel file for this. I am able to highlight words with a VBA, but wen there is a single cell with a large number of letters for example in B2 (ALGNGCTHMNSSJCDGJNACHSKDNHMJC) and when i am looking to highlight certain letters in the C column LIST (NG, NS, NA, NH) with different respective colours, I am unable to.

    Is this even possible? Any advice or help would be greatly appreciated.

    Many Thanks,

    Joseph
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Highlighting specific letters in a cell with different colours


    Hi,

    yes it's doable - just using the Macro Recorder ! - but in your attachment you forgot the desired colors in C2:C11 …

  3. #3
    Registered User
    Join Date
    05-29-2020
    Location
    london, england
    MS-Off Ver
    365
    Posts
    4

    Re: Highlighting specific letters in a cell with different colours

    Hi,

    Apologies, any colours are fine as long as they are different for each letter combination. Do you have an example macro for this that i can work with?

    Many thanks,

    Joseph

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Highlighting specific letters in a cell with different colours


    To start the VBA procedure is to just activate the Macro Recorder and operate manually.
    For further help I just need an attachment with text colors in Range C2:C11 …

  5. #5
    Registered User
    Join Date
    05-29-2020
    Location
    london, england
    MS-Off Ver
    365
    Posts
    4

    Re: Highlighting specific letters in a cell with different colours

    Hi,

    would this do? or do you need vb colours?
    Attached Files Attached Files

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

    Re: Highlighting specific letters in a cell with different colours

    Try
    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Try this demonstration !


    According to last attachment (only column C as per initial post) as a VBA beginner starter :

    PHP Code: 
    Sub Demo1()
                 
    Dim Rg As RangeS&
        
    With [B2]
               .
    Font.ColorIndex xlAutomatic
            
    For Each Rg In Range("C2", [C1].End(xlDown))
                      
    InStr(.TextRg.Text)
                While 
    S
                     
    .Characters(SLen(Rg.Text)).Font.ColorIndex Rg.Font.ColorIndex
                      S 
    InStr(1, .TextRg.Text)
                
    Wend
            Next
        End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  8. #8
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    528

    Re: Highlighting specific letters in a cell with different colours

    Similarly.
    Please Login or Register  to view this content.
    Best Regards,
    Maras.

  9. #9
    Registered User
    Join Date
    05-29-2020
    Location
    london, england
    MS-Off Ver
    365
    Posts
    4

    Re: Try this demonstration !

    Brilliant! It works perfectly! Thankyou!

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

    Re: Highlighting specific letters in a cell with different colours

    You are welcome and thaks for the rep.

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

+ 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. Highlighting text thats the same in different colours
    By davidstokes in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-28-2019, 09:16 AM
  2. Macro that colours cells acording to specific cell
    By joao1232 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-12-2017, 10:54 PM
  3. Colour Specific Interior Cell Colours
    By jodyjohnstone in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-28-2016, 10:55 AM
  4. Specific cell Colours for Specific Days
    By lpfaint43 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-20-2015, 11:50 PM
  5. Highlighting cell when DOB is after specific date
    By usmccstimp in forum Excel General
    Replies: 1
    Last Post: 01-29-2011, 11:38 PM
  6. Highlighting cells in colours
    By royst in forum Excel General
    Replies: 1
    Last Post: 07-20-2010, 06:05 PM
  7. Highlighting duplicates in different colours
    By wowzers in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-07-2009, 12:24 AM

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