Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default General Text Search and Highlight

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default General Text Search and Highlight

See the help example in the VBE for FindNext

--
Regards,
Tom Ogilvy

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to highlight the results of a search string in a worksheet? Raju Excel Worksheet Functions 1 October 22nd 09 11:52 AM
Highlight Search Results edo Excel Discussion (Misc queries) 1 April 25th 08 09:07 PM
Search and highlight Paul Findlay Excel Discussion (Misc queries) 3 February 16th 08 12:00 AM
Format: General - Text - General iturnrocks Excel Worksheet Functions 3 August 11th 06 04:47 PM
Search should highlight entire row in Excell in red samuel Excel Discussion (Misc queries) 5 December 27th 04 11:49 PM


All times are GMT +1. The time now is 01:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"