ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change text color (https://www.excelbanter.com/excel-programming/288297-change-text-color.html)

Mike Fogleman

Change text color
 
Hi, I have two columns of data B & K with same number of rows. Column K
values are the result of a cell formula. I want to change the text color of
B5 to red if it is less than K5. I have a variable named RowCount available
with the number of rows that are in the columns if that can be of any use.

TIA Mike



Tom Ogilvy

Change text color
 
You can do this with conditional formatting - no code needed

Format=Conditional formatting

--
Regards,
Tom Ogilvy

Mike Fogleman wrote in message
...
Hi, I have two columns of data B & K with same number of rows. Column K
values are the result of a cell formula. I want to change the text color

of
B5 to red if it is less than K5. I have a variable named RowCount

available
with the number of rows that are in the columns if that can be of any use.

TIA Mike





Mike Fogleman

Change text color
 
Tom, I have fooled around with that, but I forgot to mention that Column K
will be deleted afterwards and I want the appropriate numbers in B to remain
Red. I could not get that to happen with Conditional Formatting.
I think I need a loop.
Mike
"Tom Ogilvy" wrote in message
...
You can do this with conditional formatting - no code needed

Format=Conditional formatting

--
Regards,
Tom Ogilvy

Mike Fogleman wrote in message
...
Hi, I have two columns of data B & K with same number of rows. Column K
values are the result of a cell formula. I want to change the text color

of
B5 to red if it is less than K5. I have a variable named RowCount

available
with the number of rows that are in the columns if that can be of any

use.

TIA Mike







Tom Ogilvy

Change text color
 
Dim rng as Range, cell as Range
set rng = Range(cells(1,2),cells(rows.count,2).end(xlup))
for each cell in rng
if cell.Value < cell.offset(0,9).Value then
cell.font.ColorIndex = 3
else
cell.font.ColorIndex = xlautomatic
end if
Next

--
Regards,
Tom Ogilvy

Mike Fogleman wrote in message
...
Tom, I have fooled around with that, but I forgot to mention that Column K
will be deleted afterwards and I want the appropriate numbers in B to

remain
Red. I could not get that to happen with Conditional Formatting.
I think I need a loop.
Mike
"Tom Ogilvy" wrote in message
...
You can do this with conditional formatting - no code needed

Format=Conditional formatting

--
Regards,
Tom Ogilvy

Mike Fogleman wrote in message
...
Hi, I have two columns of data B & K with same number of rows. Column

K
values are the result of a cell formula. I want to change the text

color
of
B5 to red if it is less than K5. I have a variable named RowCount

available
with the number of rows that are in the columns if that can be of any

use.

TIA Mike









Mike Fogleman

Change text color
 
That worked! I was having trouble with set rng=.
"Tom Ogilvy" wrote in message
...
Dim rng as Range, cell as Range
set rng = Range(cells(1,2),cells(rows.count,2).end(xlup))
for each cell in rng
if cell.Value < cell.offset(0,9).Value then
cell.font.ColorIndex = 3
else
cell.font.ColorIndex = xlautomatic
end if
Next

--
Regards,
Tom Ogilvy

Mike Fogleman wrote in message
...
Tom, I have fooled around with that, but I forgot to mention that Column

K
will be deleted afterwards and I want the appropriate numbers in B to

remain
Red. I could not get that to happen with Conditional Formatting.
I think I need a loop.
Mike
"Tom Ogilvy" wrote in message
...
You can do this with conditional formatting - no code needed

Format=Conditional formatting

--
Regards,
Tom Ogilvy

Mike Fogleman wrote in message
...
Hi, I have two columns of data B & K with same number of rows.

Column
K
values are the result of a cell formula. I want to change the text

color
of
B5 to red if it is less than K5. I have a variable named RowCount
available
with the number of rows that are in the columns if that can be of

any
use.

TIA Mike












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

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