multi colors to be used in a cell

  • Thread starter Thread starter jladika
  • Start date Start date
J

jladika

i have tryed to get help with this problem before
and it worked one time and something happened and I lost the progra
again something changed
please this is a very important problem that i have would it be out o
line to ask someone to call me and help me that way
941-755-5257 office ask for joe


thanks agai
 
Joe

Are you talking about different Font Colors in a cell?

You could do this manually by editing in the Formula bar.

Or by macro.....

Sub Cell_Font_Colour()
ActiveCell.Characters(Start:=1, length:=5).Font.ColorIndex = 3
ActiveCell.Characters(Start:=1, length:=5).Font.ColorIndex = 5
End Sub


Sub CellFont()
With ActiveCell.Characters(Start:=1, length:=5).Font
.ColorIndex = 3
.Bold = True
.Underline = True
.Size = 14
End With
With ActiveCell.Characters(Start:=6, length:=3).Font
.Superscript = True
.ColorIndex = 5
End With
End Sub

Gord Dibben Excel MVP
 
perhaps you can describe your problem in this post a little more if you
haven't found a solution yet?
 
thanks for the reply

No i dont want the fonts to be different colors
i would like the cells to be different colors
say

when i put in the letter "A" I want the cell to turn blue
when i put in the letter "B" I want the cell to turn green
when I put in the letter "C" I want the cell to turn orange
when I put in the letter "D" I want the cell to turn red
when I put in the letter"E" I want the cell to turn brown


the colors really at this time dont really matter. what i need to do i
find a way to get the cells in Column "D" to reach when i put th
letters in.
Please help m
 
Joe

Right-click on the sheet tab and "View Code".

Copy/paste this into the worksheet module.

Note the colorindex numbers. Adjust to suit.

Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Dim vRngInput As Variant
Set vRngInput = Intersect(Target, Range("D:D"))
If vRngInput Is Nothing Then Exit Sub
On Error GoTo endit
Application.EnableEvents = False
For Each rng In vRngInput
'Determine the color
Select Case rng.Value
Case Is = "A": Num = 10 'green
Case Is = "B": Num = 1 'black
Case Is = "C": Num = 5 'blue
Case Is = "D": Num = 7 'magenta
Case Is = "E": Num = 46 'orange
Case Is = "F": Num = 3 'red
End Select
'Apply the color
rng.Interior.ColorIndex = Num
Next rng
endit:
Application.EnableEvents = True
End Sub

Gord Dibben Excel MVP
 
Please tell me
when i copie the to a new spreadsheet it works great
but if i copie and paste into the spredsheet i am using it does not
work. any good reason. ( it is the same )
 
Back
Top