ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formula to manipulate cell font (https://www.excelbanter.com/excel-programming/372616-formula-manipulate-cell-font.html)

crs

Formula to manipulate cell font
 
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


Tom Ogilvy

Formula to manipulate cell font
 
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.

--
Regards,
Tom Ogilvy


"crs" wrote:

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



Jim Thomlinson

Formula to manipulate cell font
 
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...
--
HTH...

Jim Thomlinson


"crs" wrote:

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



[email protected]

Formula to manipulate cell font
 
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

crs wrote:
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



crs

Formula to manipulate cell font
 
Thanks so much for the quick response. The idea didn't even cross my
mind.

Clay
Tom Ogilvy wrote:
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.

--
Regards,
Tom Ogilvy


"crs" wrote:

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




crs

Formula to manipulate cell font
 
Thanks to everyone for the help -
Asking is one of the best ways to learn!

wrote:
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

crs wrote:
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




All times are GMT +1. The time now is 07:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com