Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to set color for text based on conditions?
Does anyone have any suggestions on how to set color for text based on
following conditions? For example, A1 = "Peter", A2 = "Pan" CONCATENATE(A1,A2) in cell B1, I would like to set red color for A1, and blue color for A2 under cell B1. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to set color for text based on conditions?
Hi,
You can't do that. You could have the actual text values in the cell and by selecting each word in the formula bar set them to different colours. Mike "Eric" wrote: Does anyone have any suggestions on how to set color for text based on following conditions? For example, A1 = "Peter", A2 = "Pan" CONCATENATE(A1,A2) in cell B1, I would like to set red color for A1, and blue color for A2 under cell B1. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
How to set color for text based on conditions?
As Mike said, you can't do that at the worksheet level; however, you can do
what you want using VBA event code. Right-click the tab at the bottom of the worksheet you want this functionality on and select View Code from the popup menu that appears; then copy/paste the following into the code window that opened up when you did that... Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("A1:A2")) Is Nothing Then On Error GoTo RestartEvents Application.EnableEvents = False With Range("B1") .Value = Range("A1").Value & Range("A2").Value .Characters(1, Len(Range("A1").Value)).Font.ColorIndex = 3 .Characters(Len(Range("A1").Value) + 1).Font.ColorIndex = 5 End With End If RestartEvents: Application.EnableEvents = True End Sub Okay, go back to your worksheet and enter some values into A1 and A2 and watch what happens in B1. -- Rick (MVP - Excel) "Eric" wrote in message ... Does anyone have any suggestions on how to set color for text based on following conditions? For example, A1 = "Peter", A2 = "Pan" CONCATENATE(A1,A2) in cell B1, I would like to set red color for A1, and blue color for A2 under cell B1. Does anyone have any suggestions? Thanks in advance for any suggestions Eric |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
sort based on text color | Excel Discussion (Misc queries) | |||
Count text based on multiple (2) conditions | Excel Worksheet Functions | |||
Cond. format text color based on another's text color | Excel Discussion (Misc queries) | |||
Counting based upon 2 conditions that are text based | Excel Discussion (Misc queries) | |||
Searching based on Text color | Excel Worksheet Functions |