"If" statement?

B

baileygrrrl

Is there a way to have excel to highlight each instance of a particular word
in a file?

Eg. I need excel to look for the word "delivered" in a worksheet and
highlight it each time it finds that word - by highlight I mean change the
text colour or cell shading or some other way to make it stand out.
 
G

Guest

hi,
Private Sub ComboBox2_Change()
Dim c As String
Dim rng As Range
Dim cell As Range
Dim sAddr As String
c = Inputbox ("Enter something to find")
Range("A1:iv65000").Interior.ColorIndex = xlNone
If c = "" Then Exit Sub
Set rng = Range("A1:IV65000").Find(What:=c, _
After:=Range("A1"), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
sAddr = rng.Address
Do Until rng.Address = sAddr
rng.Interior.ColorIndex = 42
Set rng = Range("A1:IV65000").FindNext(rng)
Loop End If
End Sub
 
B

Bob Phillips

How about conditional formatting. You could have a condition like

=A1=$A$1

where the word is in A1, and apply to a whole range.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top