0

When I use Excel it allows me to set specific words within a cell to bold or italic or even change the text size.

Is there a way of doing this in VBA?

I have two cells with text. One cell contains a list of words which I separated into an array. The other cell contains a few sentences.

I want to write a macro that highlights all words from cell 1 in cell 2.

My idea was to use the array and InStr to search for the position of my words in cell 2. Once found I wanted to split cell 2, format one word an put everything back together.

Maybe this is possible via Word?

Moritz Schmitz v. Hülst
  • 3,229
  • 4
  • 36
  • 63

1 Answers1

4

I believe the answer could be found here: excel vba: make part of string bold

Specifically,

ActiveCell.FormulaR1C1 = "name/A/date" & Chr(10) & "name/B/date" & Chr(10) & "name/C/date"
With ActiveCell.Characters(Start:=25, Length:=4).Font
    .FontStyle = "Bold"
End With
Community
  • 1
  • 1