Font colours in formulae

Panikos

New Member
Joined
Aug 18, 2002
Messages
9
I would like to write an "IF" function where when the answer is right then the result will come up in a colour(e.g.blue) and if it it is wrong it would come up in a different colour(e.g.red).

Thanks
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
What do you mean by "come up" ?

Have you looked at conditional formatting ? that might hold your answer.

HTH

Chris
 
Upvote 0
Hi Panikos,

You need to use Conditional Formatting.

Go to Format on the main menu and then select Conditional Formatting. Enter the details that are relevant for your situation and then choose the desired formatting, eg red font for a negative value.

HTH
 
Upvote 0
On 2002-10-15 09:54, Panikos wrote:
I would like to write an "IF" function where when the answer is right then the result will come up in a colour(e.g.blue) and if it it is wrong it would come up in a different colour(e.g.red).

Thanks

This can also be accomplished (to a limited extent) using custom number formatting. For discussion purposes suppose a "right" result if >= 0 and a "wrong" one is negative. The following number format would accomplish your objective...

[Blue][>=0]General;[Red]-General

For more on custom number formatting see the Excel Help topics for "Create a custom number format" and "About number format codes for decimal places, spaces, colors, and conditions".
 
Upvote 0
Hi Try this add to the sheet module as is and test

Edit is easy need to keep array the same add words to same number of colour choices, play arroud good fun

Jack

||||||||||||||||||

Option Base 1
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next

' Dedicated to all the guys who help +
' support Jack on this board thanks so much

Dim Names As Variant
Dim Colours As Variant
Dim x As Integer
Dim y As Integer
Names = Array("Jack", "UK")
'Above are object to the text in these cells
' these wil also colour that word to @cool eh!@
Colours = Array(6, :cool:
' 6 - Yellow
' 8 - Blue
For x = 1 To UBound(Names)
y = InStr(1, Target.Value, Names(x))
If y > 0 Then
With Target.Characters _
(Start:=y, _
Length:=Len(Names(x))).Font
.ColorIndex = Colours(x)
.FontStyle = "Bold"
End With
End If
Next x
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,691
Members
448,978
Latest member
rrauni

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