Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Abdul,
Try setting the Find method's LookAt parameter to XlWhole. For example (lightly adapting the Help example code): '============= Public Sub Tester001() Dim rng As Range Dim firstAddress As String Const searchStr As String = "Tra*" With ActiveSheet.Cells Set rng = .Find(searchStr, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) If Not rng Is Nothing Then firstAddress = rng.Address Do rng.Interior.ColorIndex = 6 Set rng = .FindNext(rng) Loop While Not rng Is Nothing _ And rng.Address < firstAddress End If End With End Sub '<<============= If I ran the above code on a sheet which contained multiple examples of all of your suggested words, only those words that commenced with the letters 'tra' were highlighted. --- Regards, Norman "Abdul" wrote in message oups.com... Sorry, I think I did'nt make it clear.. I want to search part of a cell starting from the first character only.. So that TRA* will find TRAvel, TRAnsport, TRAde etc but it should exclude cenTRAl or conTRAct since it does not start with TRA Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find String in another string - only between spaces | Excel Worksheet Functions | |||
Find Many String options in ONE String | Excel Worksheet Functions | |||
search a string withing a string : find / search hangs | Excel Programming | |||
backwards find function to find character in a string of text | Excel Programming | |||
find a string inside another string | Excel Programming |