YoungTurk
Mechanical
- Jul 16, 2004
- 333
I need to be able to append text to an existing cell without changing the existing text colors. My current code looks like this:
The problem arises when the existing text is formatted with multiple colors. It seems only the first color is maintained when the cell contents are re-written. Since I've used these text colors to visually differtiate separate entities, this causes a problem.
Code:
If ActiveCell.Value = Empty Then
ActiveCell.Value = Item & Chr(10)
'TEXT COLOR ROUTINE
With ActiveCell.Characters(, Len(Item) + 1).Font
.Color = RGB(r, g, b)
End With
Else
Temp2 = ActiveCell.Value
ActiveCell.Value = ActiveCell.Value & Item & Chr(10)
'TEXT COLOR ROUTINE
With ActiveCell.Characters(Len(Temp2), Len(Item) +1).Font
.Color = RGB(r, g, b)
End With
End If
The problem arises when the existing text is formatted with multiple colors. It seems only the first color is maintained when the cell contents are re-written. Since I've used these text colors to visually differtiate separate entities, this causes a problem.