Hi Luca, You can use the instr function.
e.g.: instr(string, searchstring) will give you the starting position of the searchstring. Len(searchstring) will give you the length of the portion to highlight. Regards, Andy On Thu, May 14, 2009 at 1:05 PM, JazzyXXL <camere...@web.de> wrote: > > Hi Fabio, > the problem is, that I do not know the exact position of the word in > the cell text. > I think the code should be structured like this: > > 1. search for WORD in cells of column 2 > --> text found in cell(x,y) > > 2. find position of WORD in cell text > --> Start = 0 > --> Start=instr(Start+1,cell(x,y).value,WORD,0) > --> Length = len(WORD) > --> change color or style > With Cell(x,y).Characters(Start:=6, Length:=3).Font > .FontStyle = "Bold" > .Color = -16776961 > End With > > 3. repeat 2. until end of cell text is reached to find every WORD in > the text > > 4. find next cell until end of column reached. > > What do you think about it? > > Best regards, > Luca > > > > --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---