• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Highlight the searched contents by using CTRL+F

Mudassar.freedi

New Member
Dear,


can excel highlight the "lazy dog" in a cell, if we search text by using CTRL+F?


like, if A1 cell contains "A quick brown fox jumps over the lazy dog". then "lazy dog" should be highlighted if search command given.


Thanks

Mudassar
 
Mudassar,


Though a valid query, however in the context of Excel this is not valid and also I do not see a valid reason for asking this feature.


When searching for some text in Excel, it takes you to the cell that contains the search string as the cell is the placeholder for the same.


You are able to using this feature in Word, notepad, etc and they are document editors.


Excel is a spreadsheet and one needs to understand this.


Having said that, though I have not tried this as of now, I think this can be done using VBA.


HTH


~VijaySharma
 
Vijay,


thanks for your comments. you are right but i have used little example here instead i have a big assignment contains more than 100 words in each cells.


now tell me; how can we find a word if excel contains more than 100 words in each cells x 1000 rows x 20 columns data?


Rgds,

Hafiz
 
Mudassar,


try the below and change are per your needs


Code:
Sub srch()


    myword = "dog"


    'assuming your statement is in cell a1


    With Range("a1")

.Characters(Start:=InStr(.Value, myword), Length:=Len(myword)) _

.Font.Bold = True

End With

With ActiveCell

.Characters(Start:=InStr(.Value, myword), Length:=Len(myword)) _

.Font.Color = vbRed

End With

End Sub


~VijaySharma
 
Hi Mudassar ,


The link given below , has a VBA procedure which does what I think you are looking for , though it is not based on using CTRL + F.


http://www.excelforum.com/excel-programming/753248-vba-code-to-find-and-highlight-specific-text-in-entire-workbook-not-just-active-sheet.html


Narayan
 
Back
Top