+ Reply to Thread
Results 1 to 10 of 10

Highlight words/phrases from a list

  1. #1
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Highlight words/phrases from a list

    Hi all,

    I am a complete novice with macros and VBA

    I have a list of words in column G, and sometimes two words or phrases with a comma. I am trying to highlight on each line in column E, any data which is relating to the cell in column G

    For example, Cell G2 has 0
    I want 0 to be highlighted in cell E2 in red


    If cell G3 says: service,delivery I want cell E3 to have the words service and delivery highlighted in red.


    I am trying this:
    Sub HL()
    Dim r As Range, l As Long
    For Each r In Range("E2", Range("E99999").End(xlUp))
    l = InStr(1, r.Value, r.Offset(0, -6).Value, 1)
    If l Then r.Characters(Start:=l, Length:=Len(r.Offset(0, -6).Value)).Font.Color = vbRed
    Next
    End Sub

    Can somerone please help? My spreadsheet is attached
    Attached Files Attached Files
    Thanks,

    R.



  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Highlight words/phrases from a list

    Please try

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Re: Highlight words/phrases from a list

    Hi Bo_Ry

    thank you do much!

    Is there a way to make this work for multiple words i.e. cell E1574 and a few after that have two words: paid,00

    for example?

    Thank you!

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

    Re: Highlight words/phrases from a list

    Try
    Please Login or Register  to view this content.
    Last edited by jindon; 02-05-2021 at 03:27 AM.

  5. #5
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Re: Highlight words/phrases from a list

    Thank you Jindon, unfortunately this is returning a type mismatch error and then also it is highlighting most of the first set of words but then it doesn't highlight the rest and definitely does not highlight multiple words.

    Any suggestions please?

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

    Re: Highlight words/phrases from a list

    Working to me.
    Attached Files Attached Files

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Highlight words/phrases from a list

    I Forgot to change the red t.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Bo_Ry; 02-05-2021 at 04:23 AM.

  8. #8
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Re: Highlight words/phrases from a list

    Thank you both, looks like some errors were being caused due to NAME errr. You have both been very helpfuil!

  9. #9
    Forum Contributor
    Join Date
    11-13-2015
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    831

    Re: Highlight words/phrases from a list

    Quote Originally Posted by Bo_Ry View Post
    I Forgot to change the red t.

    Please Login or Register  to view this content.
    Hello,

    All. I want to re-open this thread.

    How can I be helped with my issue that case sensitive and/or partial matches are not being picked up? So in the workbook in this thread, row 1347, the words 'not used' from column G does not highlight the words 'Not used' in column E because of the capital N in the word 'Not. What if my text said not used. (lower case and full stop?) can someone advicse and help me update the macro?

    thank you

  10. #10
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Highlight words/phrases from a list

    Add Option Compare Text

    Please Login or Register  to view this content.

+ 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. Bingo Cards from a list of words or phrases
    By shihfa in forum Excel General
    Replies: 6
    Last Post: 04-08-2020, 09:27 PM
  2. Replies: 1
    Last Post: 10-22-2015, 06:11 PM
  3. Formula to retrieve common phrases/words.
    By Martin2015 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-15-2015, 03:32 PM
  4. Replies: 2
    Last Post: 08-11-2015, 01:24 PM
  5. Finding certain words and phrases in a cell
    By JakeMann in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-30-2013, 01:25 AM
  6. Categorizing a List of Words by Referencing Another List of Phrases
    By samebito in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-29-2012, 02:26 PM

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