+ Reply to Thread
Results 1 to 15 of 15

find a word in entirebook and highlight it.

  1. #1
    Registered User
    Join Date
    03-21-2009
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    60

    find a word in entirebook and highlight it.

    Hi Friends,

    I need a macro to find a word in entire workbook and need to highlight it. Please help me with the code.



    Thanks
    Rams

  2. #2
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: find a word in entirebook and highlight it.

    Please Login or Register  to view this content.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  3. #3
    Registered User
    Join Date
    11-23-2009
    Location
    Porto, Portugal
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: find a word in entirebook and highlight it.

    This is my first contribution on VBA code so please be kind if it's wrong.
    If you want to input the phrase that is to be searched use this:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-21-2009
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: find a word in entirebook and highlight it.

    Hi lopiner and rwgrietveld


    Thank you very much for replying my post.

    I used lopiner's code it is working even rwgrietveld's code also working.

    Thanks & Regards
    Ram

  5. #5
    Registered User
    Join Date
    03-21-2009
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: find a word in entirebook and highlight it.

    Hi lopiner and rwgrietveld,

    It is highlighting the entire cell. Can't we highlight the one word in cell which has more than one word.

    ex: Cell A1 contains a word like "Chandra Babu Naidu". I want to find a word "babu" and highlight it. Please provide the code if it possible to hightlight in this manner.


    Thanks & Regards
    Ramesh

  6. #6
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: find a word in entirebook and highlight it.

    Simple adjustment
    Please Login or Register  to view this content.
    Last edited by rwgrietveld; 11-27-2009 at 07:42 AM.

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: find a word in entirebook and highlight it.

    I'd just add that if the word of interest is found in a cell containing formulae you can not partially format the cell (ie just the word)

    (also, not clear if say theme should be highlighted or not)

  8. #8
    Registered User
    Join Date
    03-21-2009
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: find a word in entirebook and highlight it.

    Hi rwgrietveld,


    It is working fine. Thank you very much for replying my post.


    Thanks & Regards
    Ramesh

  9. #9
    Registered User
    Join Date
    03-21-2009
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: find a word in entirebook and highlight it.

    Hi rwgrietveld,

    The code sent by you working properly. I need little enhancement on this code. When I find a word all the words with that name turned into red color when I find for second word all the previously founded words color(red) need to turn into black.


    Ex: First I find "Ramesh Katta" in the sheet our code finds it and highlight in red color

    When I find for second time for other word previously highlighted word ("Ramesh Katta") needs to be turn into black.

    I am very sorry for coming every time with new issue.

    Please kindly help me with enhancement of the code.


    Thanks & Regards
    Ramesh

  10. #10
    Registered User
    Join Date
    12-01-2009
    Location
    Cebu, Philippines
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: find a word in entirebook and highlight it.

    hi rwgrietveld, im sorry if interfere with your discussion, just tell me if i violate again another rule in the forum... i tested ur code and it works... but i want a little revision of that. i want to search a word in sheet2 that much the word in sheet1... is it possible if the excel would jump to sheet2 to from sheet1 with the word i want to search is highlighted....

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: find a word in entirebook and highlight it.

    Quote Originally Posted by miyat
    ...just tell me if i violate again another rule in the forum
    Correct.

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

    I've asked you read the rules previously... you have not done so.

  12. #12
    Registered User
    Join Date
    03-21-2009
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: find a word in entirebook and highlight it.

    Hi rwgrietveld,

    I need little enhancement for this code.

    When I search for second word then the previously founded word needs to turn into black.

    ex: We found ABC first time (It found and turned into red color). When I try for second the first founded word "ABC" should turn into black.

    I appreciate you for all your help.

    Please kindly help me with enhancement of the code.


    Thanks & Regards
    Ramesh

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

    Re: find a word in entirebook and highlight it.

    How about Defining a name Name: KeyWord, RefersTo: "yourWord"

    And putting Conditional Formatting on all the cells with the formula =(A1=KeyWord)
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  14. #14
    Registered User
    Join Date
    03-21-2009
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    60

    Re: find a word in entirebook and highlight it.

    Hi,

    I asked enhancement for this code. The following code performing the task that finding a word in entirebook and highlighting it. What I want now is when find any word second time previously founded words turn into normal color.

    Please Login or Register  to view this content.
    Please kindly modify the code to turn off the color of font for previously founded words.

    Thanks & Regards
    Ramesh

  15. #15
    Registered User
    Join Date
    04-09-2014
    Location
    Gaylord, MI
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: find a word in entirebook and highlight it.

    Hi rwgrietveld,
    I found your code while searching for a routine to do exactly what you generated, it works great. I added a message box to the beginning of the routine so the user can define the variable FindWord each time they run the macro. By any chance would it be too difficult to add two features:

    1) have it not be case sensitive? I've noticed it always finds the correct cell regardless of the case matching, but if the cell contains all caps and I enter lower case it doesn't always highlight the correct sub string in the cell.

    2) can the routine easily highlight all occurrences of the FindWord in a single cell? In some case the same word will appear more than once in the same cell.

    Thanks so much for a great routine!

+ 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