VBA String color built based on value


Board Regular
Jan 26, 2015

I am working on a translation of part numbers from provider's to my company's standards.

Provider's part numbers contain several words/numbers divided with spaces (all in one cell) - and my code translate them word by word by using vlookups from other sheet.

So, the part number (product of translation from provider's PN) is being built in the code by adding word by word.

I want specific words to be of different color / bold font.


NewPN = Translation1 & " " & Translation2(RedColor) & " " & Translation3(Bold) & " " & Translation4

Is it possible to build string with specific color of parts (by adding specifications of the font in an example code above) or does it require to be handled in another way? I've found some solutions which apply color change to an existing content of a cell but I was trying to figure out if this can be done as part of translation - one process and not two processes (translation and adding value to a cell, then manipulating the formatting of font)?

If you need more details, let me know. I've last minute changed way to explain the problem and forgot to update Subject - in general the translations that need to be colored differently will be specific values (such as "-") but I didn't want to make it too complicated as I would know how to deal that conditional part - the problem I don't know to solve currently is around manipulating the color.

Thanks for support in advance!
Last edited:


Well-known Member
Mar 14, 2002
Formula results can't have various colors -- one color results only.
You can only have various colors in constants.


Board Regular
Jan 26, 2015
Thanks BobUmlas for quick response. Does that mean that I need to manipulate the color after the whole translation is completed?


MrExcel MVP
Jan 15, 2007
Different colored letters are set after the string is put in a cell. (Unlike PET ASCII, there are no color characters built into an excel string.)
You would have to use VBA and build the string, noting the characters locations when you want the colors to change, put the string into a cell and then use that noted informtion to change the .Characters .Font.Color property of that cell.

Forum statistics

Latest member
Asraful Alam

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...