I am trying to underline, bold and italicized certain portions of text within a cell. My first line of text starts at line 2, where I am trying to bold the second and third line of this cell. The last part of line 2, I am trying to italicized this. Line 5 needs to be underlined. I have a list of these that I am trying to go through, so I started with a 'for loop'. I can get the first two lines to be bold, but I have trouble getting the italic and underline portion right.
Here's what I'm starting with:
Here's what I'm going for:
Public Sub HUBSpecificStyle()
Dim LongRow As Long
Dim cel As Range
Dim rng As Range
Dim varContent, varFirstRow
Dim FoodRange As Range
'Looping through all cells in selection
For Each cel In Range("A2:A")
varContent = Split(cel.Value, Chr(10)) ' Spliting cell contents by newline character
With cel
varContent = Split(cel.Value, Chr(10)) ' Spliting cell contents by newline character
.Characters(1, (Len(varContent(0) & varContent(1)) + 1)).Font.Bold = True
.Characters(Len(varContent(1)) + 1, Len(varContent(2)) + 2).Font.Bold = True
Debug.Print cel
End With
Next cel
End Sub