Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Adelina Fischer   on Jan 04 In MS Office Category.

  
Question Answered By: Bobbie Gonzalez   on Jan 04

Suppose you want to search  for the word "test" in a worksheet containing
several words in each cell then this code will search for the word "test"
starting from the first cell and highlight  it with a yellow color.

Sub SearchText()

Range("A1").Select
Cells.Find(What:="test", After:=ActiveCell, LookIn:=xlValues).Activate
ActiveCell.Interior.ColorIndex = 6

End sub

This is just the tip of the iceberg as a lot can be done like multiple
searches and so on.

This code can be tied to a button which you can keep on your worksheet. As you
press this button the text will get highlighted by itself.

Share: 

 
 
Didn't find what you were looking for? Find more on VBA - Excel (Search Command) Or get search suggestion and latest updates.


Tagged: