Formula to manipulate cell font

C

crs

I realize that in some cases you can use conditional formatting to
change the color of the cell contents according to cell value, but I
need to change the color of one cell's contents according to the value
of a different cell. For instance....if B1 = x, then C1 is red but if
B1 = y, then C1 is blue..........any suggestions.
Clay
 
G

Guest

You can do that with conditional formatting as well. You can change Cell
Value is to formula is and put in a formulat that refers to the other cell.
 
G

Guest

You can still use conditional formatting. Change Cell Value is to Formula is.
The formula you want is =B1=x for one condition and for the second condition
=B1=y. set your font colors on each and you are good to go...
 
A

acampbell012

Clay, Try this. However, coding this depends on how many formatting
choices you want.

Sub TestFormat()
Dim MyCell As Range
For Each MyCell In Selection
If MyCell.Value = "x" Then
With MyCell.Offset(0, 1).Font
.Bold = True
.ColorIndex = 3
End With
Else
With MyCell.Offset(0, 1).Font
.Bold = True
.ColorIndex = 5
End With
End If
Next MyCell
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top