color certain words in an expression

Usaskater

New Member
Joined
May 7, 2010
Messages
34
I have three columns:



Teamdayroom
one​
tue
3​
two​
wed
4​
three​
thu
5​
four​
five​

In the query I made and expression DOWRM: ([team] & " " & [day] &" " &room]).
I placed this on my report and it looks great but I would like to have the following on a report

for example team one.... one tue 4

so the team would show and the day and room would be in color. I hope I explained it well! Many Thanks!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Not sure how many works is "team", but i assum day and room has 1 word each, so we have to find the 2nd space position form the right, then colour the remain text string from that pos?
With expression in column A:
VBA Code:
Option Explicit
Sub ColorText()
Dim lr&, pos&, cell As Range
lr = Cells(Rows.Count, "A").End(xlUp).Row
    For Each cell In Range("A1:A" & lr)
        pos = InStrRev(Left(cell, InStrRev(cell, " ") - 1), " ") ' find 2nd space(1) from the right
        cell.Characters(pos, 255).Font.ColorIndex = 3
        Debug.Print pos
    Next
End Sub
Capture.JPG
 
Upvote 0
Have a look here and see if you can incorporate Conditional Formatting on your report:
 
Upvote 0
À há, almost paid no attention. BTW, i got a change to practise at least. :))
Yes, many people use the "Unanswered threads" listing to look for new unanswered questions to answer, and miss the forum listed under the question:
1651239724621.png
 
Upvote 0
Not really enough info to provide definitive answer IMO. What colour would Wed. (Wednesday) be? What happens when 4 becomes 5? Might have to format the table field as rtf, and to do that it needs to be long text type (aka Memo).
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,271
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top