I adding a string to a cell like this.
How can I format the added string to be font.color = red![]()
bCell.Value = bCell.Value & vbLf & Format(StartHr, "0000") & " Start RX"
I do not want the entire cell to be red.
I adding a string to a cell like this.
How can I format the added string to be font.color = red![]()
bCell.Value = bCell.Value & vbLf & Format(StartHr, "0000") & " Start RX"
I do not want the entire cell to be red.
maybe
![]()
bCell.Value = bCell.Value & vbLf & Format(654654, "0000") & " Start RX" bCell.Characters(InStr(bCell, Chr(10)) + 1).Font.Color = vbRed
That would only look for the first Chr(10) and apply everything after correct.
I would like to be able to have a different color for each line of characters added to the cell (delimited by Chr(10)).
In retrospect, using individual cells for the information would have been easier for formating, but I need the row height to be dynamic.
or so
![]()
arr = Array("", vbRed, vbGreen, vbBlue, vbYellow, vbMagenta, vbCyan) sp = Split(bCell, Chr(10)) For i = 1 To UBound(sp) bCell.Characters(InStr(bCell, sp(i)), Len(sp(i))).Font.Color = arr(i) Next
Thats a great bit of code Nilem. You are awesome.
But unfortunately I didnt describe myself well enough.
I use the code to insert a line of text into the cell that i want to also be able to colorcode. Not just arbitrarily alternate colors. So some lines will be red, some black etc.
I could do an if statement and analyze each cell at the end, but why cant i just format the string when i insert it into the cell in the first place.
In any case, you have to decorate every part of the line again after inserting any substring.
may be a small sample in a file?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks