View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_4_] Patrick Molloy[_4_] is offline
external usenet poster
 
Posts: 103
Default Changing font of part of text in a cell

Sub test()
SetBoldON Range("E7"), 4, 3
End Sub

Sub SetBoldON(ByRef Target As Range, lStart As Long, lLength As Long)
With Target.Cells.Characters(start:=lStart, length:=lLength).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

End Sub


Patrick Molloy
Microsoft Excel MVP
----------------------------------
"Ross Withey" wrote in message
...
Hello,
Using VBA, I am trying to use Instr and Range(x).characters to change part
of a cell's text in Excel 97.
I do a loop to find a cell with the same text as a control cell, but as

the
text may be at different points in a cell, (e.g. one might say "Try this"
and the other might say "try again". How can I get Excel to find the "try"
in cell A2 and embolden the "try" but not the rest if it matches the "try"
in another cell (found in a loop)? It's got me beat!
Thanks if you can help!
Ross