I have string strInfo, which contains "Employee John Maybach".
How do I make the "Employee" part black text, and the "John Maybach" part red?
The "Employee" part will always remain constant, but the employee's name part will change such that it may be a 2-part name (John Doe), or a 3-part name (John Allen Doe), or just a first name (John).
I want the word "Employee" to be always black, but the rest of the text in the cell, the name part, to be red. Is this possible?
Select the cell you want to apply multiple font colors or fonts, then get into the cell with pressing the F2 key (or just double click the cell). 2. Select the text you need to use different font colors or fonts, click Home > Font Color or Font in the Font group, then specify the certain font color or font you need.
Step 1: Select a range of cells you want to format the text color. After that Hover to Home Tab > Select Conditional Formatting (in Styles section) > Select Highlight Cells Rules (from the option menu) > Choose Equal to option.
In this case, for texts that contain East, we’ll format their text color. Step 1: Select the cells you want to conditionally format. Then Go to Home Tab > Select Conditional Formatting (from Styles section) > Select Highlight Cells Rules (from the option menu) > Choose Text that Contains option. Step 2: The Text that Contains dialog box pops up.
Then highlight the text you want to change color and use the pop-up quick edit window (or right click on it to get it to show) and change the text color. Or you can use the Home->Edit ->text color.
The macro recorder is your friend:
Dim fixedLength As Long
fixedLength = Len("Employee")
ActiveCell.FormulaR1C1 = "Employee Some Employee"
With ActiveCell.Characters(Start:=fixedLength + 2, Length:=Len(ActiveCell) - fixedLength - 1).Font
.Color = vbRed
End With
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With