Change format of single word in cell

  • Thread starter Thread starter Zenon
  • Start date Start date
Z

Zenon

Hi,

I need to search and highlight (using bold, change color or whatever
single words in Excel using VBA. With find method, I can find them, bu
when using the replace method, always the complete cell, in which th
word has been found, will be highlight.

Any idea??

Thanks and regards,
Zeno
 
Zenon,

You need to use the characters method once you've found the word:

Dim myStr As String
ActiveCell.Value = "This word is bold and red."
myStr = "word"
With ActiveCell.Characters(Start:=InStr(1, ActiveCell.Value, myStr), _
Length:=Len(myStr)).Font
.FontStyle = "Bold"
.ColorIndex = 3
End With

As for integrating this into your code, we would need to see your code to do
that....

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top