excel - Change font color for a part of text in cell -
i have cells contain below value
"image not allowed|png"
i want change color of |png alone or whatever comes after "|"
now trying change font color using below code
cells(4,2).font.color = rgb(255, 50, 25)
it change entire cells font color, possible change selected text color(|png
) using vba?
this should start :
sub vignesh() dim startchar integer, _ lencolor integer = 1 5 sheets("sheet1").cells(i, 1) startchar = instr(1, .value, "|") if startchar <> 0 lencolor = len(.value) - startchar + 1 .characters(start:=startchar, length:=lencolor).font.color = rgb(255, 0, 0) end if end next end sub
Comments
Post a Comment