you can try like this
Dim cel As Range, tmp as String
Dim bb As Boolean, bi As Boolean
For Each cel In Range("g:h") 'change to used range
If Not IsEmpty(cel) Then
For ch = 1 To cel.Characters.Count
If cel.Characters(ch, 1).Font.Bold And Not bb Then
bb = True
tmp = tmp & "<b>"
ElseIf Not cel.Characters(ch, 1).Font.Bold And bb Then
bb = False
tmp = tmp & "</b>"
End If
If cel.Characters(ch, 1).Font.Italic And Not bi Then
bi = True
tmp = tmp & "<i>"
ElseIf Not cel.Characters(ch, 1).Font.Italic And bi Then
bi = False
tmp = tmp & "</i>"
End If
If bb Then tmp = tmp & "</b>"
If bi Then tmp = tmp & "</i>"
cel.Value = tmp
tmp = tmp & cel.Characters(ch, 1)
Next
End If
Next
i did not test this so may contain error or typo, test before using, the cell result will no longer contain formatting, if you want to retain formatting as well as tags, you would need to use a range (cell) to hold temporary value, in place of string