ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   "If" statement? (https://www.excelbanter.com/excel-worksheet-functions/11486-%22if%22-statement.html)

baileygrrrl

"If" statement?
 
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.


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

-----Original Message-----
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.
.


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)


"baileygrrrl" wrote in message
...
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.





All times are GMT +1. The time now is 10:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com