Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,670
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,934
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sort based on text color Nick@Durham Excel Discussion (Misc queries) 1 May 3rd 07 04:39 PM
Count text based on multiple (2) conditions Leathal711 Excel Worksheet Functions 4 September 27th 06 03:49 AM
Cond. format text color based on another's text color manxman Excel Discussion (Misc queries) 3 August 31st 06 06:27 PM
Counting based upon 2 conditions that are text based walkerdayle Excel Discussion (Misc queries) 7 August 22nd 06 01:29 AM
Searching based on Text color EbonyMonarch Excel Worksheet Functions 1 February 15th 05 02:51 PM


All times are GMT +1. The time now is 12:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"