General Text Search and Highlight
Sub FindMe()
' Highlights cells that contain "Hello"
Dim rngC As Range
Dim strToFind As String, FirstAddress As String
strToFind = "Hello"
With ActiveSheet.UsedRange
Set rngC = .Find(what:=strToFind, LookAt:=xlPart, _
LookIn:=xlFormulas)
If Not rngC Is Nothing Then
FirstAddress = rngC.Address
Do
rngC.Interior.Pattern = xlPatternGray50
Set rngC = .FindNext(rngC)
Loop While Not rngC Is Nothing And rngC.Address < _
FirstAddress
End If
End With
End Sub
Tested using Excel 97SR2 on Windows 98SE,
HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------
Been trying to find a macro, example on how I might perform a find
that will highlight all occurences of a word that I want to search for
throughout a worksheet. Any suggestions would be much appreciated.
Thanks,
Jeffro
|