+ Reply to Thread
Results 1 to 2 of 2

For each instance of word in string

  1. #1
    Forum Contributor
    Join Date
    11-16-2011
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    405

    Question For each instance of word in string

    Hi guys,

    I'm trying to loop though the characters of a cell's value looking for a word, once the word is found I want to change its font colour

    I am using the Instr function to find the first instance of a word, however I wish to colour EVERY instance of the word in the string.

    How do you loop through each found instance?

    What I am currently using finds the first instance correctly:
    Please Login or Register  to view this content.
    Kind regards
    Jordan

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: For each instance of word in string

    This is the routine that I came up with to do one cell.
    You have to adjust ACell and SubString to what you are working on.
    Remove the two vbTextCompare if you want the test to be case sensitive.

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ 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. Replies: 5
    Last Post: 04-12-2014, 11:48 PM
  2. Replies: 9
    Last Post: 08-20-2013, 10:01 AM
  3. nth instance of a character in a string
    By AndrewMac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-27-2013, 11:20 AM
  4. Find nth instance of a character in a string
    By BRISBANEBOB in forum Excel General
    Replies: 1
    Last Post: 12-26-2011, 07:09 PM
  5. [SOLVED] Find nth instance of a character in a string
    By Francis Hayes (The Excel Addic in forum Excel General
    Replies: 7
    Last Post: 01-21-2005, 12:06 PM

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