ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comditional Formatting Problem (https://www.excelbanter.com/excel-programming/322732-comditional-formatting-problem.html)

Ed P[_2_]

Comditional Formatting Problem
 
Can someone help me determine what is wrong with the following code.
I am needing to change the color of the text in a cell to red if the cell is
100%.

My code I have currently is follows.

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 100 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

I appreciate any help you can give me.
If I am taking the wrong approach please advise.
Thank You
Ed

Tom Ogilvy

Comditional Formatting Problem
 
Sub Red()
Range("F9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

would be what i would try if your cells contains percentages.

Also, if you are only working with the activecell, why select more than one
cell.

--
Regards,
Tom Ogilvy


"Ed P" wrote in message
...
Can someone help me determine what is wrong with the following code.
I am needing to change the color of the text in a cell to red if the cell

is
100%.

My code I have currently is follows.

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 100 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

I appreciate any help you can give me.
If I am taking the wrong approach please advise.
Thank You
Ed




Ed P[_2_]

Comditional Formatting Problem
 
Tom,
I apprecaite your help.
I have entered the Code as you instructed, but it still is not working
correctly.
I had originally chose 2 cells because those cells are merged. I am not sure
if this is the problem or not.
Do you have any other suggestions?
Thanks again for your help.
Ed

"Tom Ogilvy" wrote:

Sub Red()
Range("F9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

would be what i would try if your cells contains percentages.

Also, if you are only working with the activecell, why select more than one
cell.

--
Regards,
Tom Ogilvy


"Ed P" wrote in message
...
Can someone help me determine what is wrong with the following code.
I am needing to change the color of the text in a cell to red if the cell

is
100%.

My code I have currently is follows.

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 100 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

I appreciate any help you can give me.
If I am taking the wrong approach please advise.
Thank You
Ed





Ben

Comditional Formatting Problem
 
do you absolutely need this to run in a macro. could you instead use the
conditional formatting function provided with Excel? Formatting Conditional
Formating
?


"Ed P" wrote:

Tom,
I apprecaite your help.
I have entered the Code as you instructed, but it still is not working
correctly.
I had originally chose 2 cells because those cells are merged. I am not sure
if this is the problem or not.
Do you have any other suggestions?
Thanks again for your help.
Ed

"Tom Ogilvy" wrote:

Sub Red()
Range("F9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

would be what i would try if your cells contains percentages.

Also, if you are only working with the activecell, why select more than one
cell.

--
Regards,
Tom Ogilvy


"Ed P" wrote in message
...
Can someone help me determine what is wrong with the following code.
I am needing to change the color of the text in a cell to red if the cell

is
100%.
My code I have currently is follows.

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 100 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

I appreciate any help you can give me.
If I am taking the wrong approach please advise.
Thank You
Ed





Tom Ogilvy

Comditional Formatting Problem
 
Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

worked fine for me with F9:G9 merged.

cell was formatted as percentage and was displaying 101%

from the immediate window you can see the actual value stored in the cell:

? ActiveCell.Value
1.01

I guess you need to see what value is actually stored in the cell.

Sub Red()
Range("F9:G9").Select
MsgBox "Value: " & ActiveCell.Value & _
" Display: " & ActiveCell.Text
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

--
Regards,
Tom Ogilvy



"Ed P" wrote in message
...
Tom,
I apprecaite your help.
I have entered the Code as you instructed, but it still is not working
correctly.
I had originally chose 2 cells because those cells are merged. I am not

sure
if this is the problem or not.
Do you have any other suggestions?
Thanks again for your help.
Ed

"Tom Ogilvy" wrote:

Sub Red()
Range("F9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

would be what i would try if your cells contains percentages.

Also, if you are only working with the activecell, why select more than

one
cell.

--
Regards,
Tom Ogilvy


"Ed P" wrote in message
...
Can someone help me determine what is wrong with the following code.
I am needing to change the color of the text in a cell to red if the

cell
is
100%.
My code I have currently is follows.

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 100 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

I appreciate any help you can give me.
If I am taking the wrong approach please advise.
Thank You
Ed







Ed P[_2_]

Comditional Formatting Problem
 
Ben, If you are meaning something like this:

[Green] [<=1] 0.0%; [Red] [1] ##0.0%; Percentage

Then yes I have tried that as well. I have not been able to get this to work
using any method. If you have other suggestions I am all ears.
Thanks for your help
Ed

"ben" wrote:

do you absolutely need this to run in a macro. could you instead use the
conditional formatting function provided with Excel? Formatting Conditional
Formating
?


"Ed P" wrote:

Tom,
I apprecaite your help.
I have entered the Code as you instructed, but it still is not working
correctly.
I had originally chose 2 cells because those cells are merged. I am not sure
if this is the problem or not.
Do you have any other suggestions?
Thanks again for your help.
Ed

"Tom Ogilvy" wrote:

Sub Red()
Range("F9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

would be what i would try if your cells contains percentages.

Also, if you are only working with the activecell, why select more than one
cell.

--
Regards,
Tom Ogilvy


"Ed P" wrote in message
...
Can someone help me determine what is wrong with the following code.
I am needing to change the color of the text in a cell to red if the cell
is
100%.
My code I have currently is follows.

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 100 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

I appreciate any help you can give me.
If I am taking the wrong approach please advise.
Thank You
Ed




Ed P[_2_]

Comditional Formatting Problem
 
Tom,
With your suggestion I have discoverd that the problem is not laying within
my code but rather the execution of the code.
I need this macro to run anytime the cell reaches 100.01%.
Do you have any suggestions for this.
We are taking a step in the right direction.
I appreciate your help on this.
Thank You
Ed

"Tom Ogilvy" wrote:

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

worked fine for me with F9:G9 merged.

cell was formatted as percentage and was displaying 101%

from the immediate window you can see the actual value stored in the cell:

? ActiveCell.Value
1.01

I guess you need to see what value is actually stored in the cell.

Sub Red()
Range("F9:G9").Select
MsgBox "Value: " & ActiveCell.Value & _
" Display: " & ActiveCell.Text
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

--
Regards,
Tom Ogilvy



"Ed P" wrote in message
...
Tom,
I apprecaite your help.
I have entered the Code as you instructed, but it still is not working
correctly.
I had originally chose 2 cells because those cells are merged. I am not

sure
if this is the problem or not.
Do you have any other suggestions?
Thanks again for your help.
Ed

"Tom Ogilvy" wrote:

Sub Red()
Range("F9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

would be what i would try if your cells contains percentages.

Also, if you are only working with the activecell, why select more than

one
cell.

--
Regards,
Tom Ogilvy


"Ed P" wrote in message
...
Can someone help me determine what is wrong with the following code.
I am needing to change the color of the text in a cell to red if the

cell
is
100%.
My code I have currently is follows.

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 100 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

I appreciate any help you can give me.
If I am taking the wrong approach please advise.
Thank You
Ed







Tom Ogilvy

Comditional Formatting Problem
 
[Green] [<=1] 0.0%; [Red] [1] ##0.0%;

worked fine for me as well. (formated the merged cells).

Ben probably wants you to try
Format=Conditional Formatting

Regards,
Tom Ogilvy


"Ed P" wrote in message
...
Ben, If you are meaning something like this:

[Green] [<=1] 0.0%; [Red] [1] ##0.0%; Percentage

Then yes I have tried that as well. I have not been able to get this to

work
using any method. If you have other suggestions I am all ears.
Thanks for your help
Ed

"ben" wrote:

do you absolutely need this to run in a macro. could you instead use the
conditional formatting function provided with Excel? Formatting

Conditional
Formating
?


"Ed P" wrote:

Tom,
I apprecaite your help.
I have entered the Code as you instructed, but it still is not working
correctly.
I had originally chose 2 cells because those cells are merged. I am

not sure
if this is the problem or not.
Do you have any other suggestions?
Thanks again for your help.
Ed

"Tom Ogilvy" wrote:

Sub Red()
Range("F9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

would be what i would try if your cells contains percentages.

Also, if you are only working with the activecell, why select more

than one
cell.

--
Regards,
Tom Ogilvy


"Ed P" wrote in message
...
Can someone help me determine what is wrong with the following

code.
I am needing to change the color of the text in a cell to red if

the cell
is
100%.
My code I have currently is follows.

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 100 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

I appreciate any help you can give me.
If I am taking the wrong approach please advise.
Thank You
Ed






Ed P[_2_]

Comditional Formatting Problem
 
We got it fugured out...
Thanks for all your help
Ed

"Tom Ogilvy" wrote:

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

worked fine for me with F9:G9 merged.

cell was formatted as percentage and was displaying 101%

from the immediate window you can see the actual value stored in the cell:

? ActiveCell.Value
1.01

I guess you need to see what value is actually stored in the cell.

Sub Red()
Range("F9:G9").Select
MsgBox "Value: " & ActiveCell.Value & _
" Display: " & ActiveCell.Text
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

--
Regards,
Tom Ogilvy



"Ed P" wrote in message
...
Tom,
I apprecaite your help.
I have entered the Code as you instructed, but it still is not working
correctly.
I had originally chose 2 cells because those cells are merged. I am not

sure
if this is the problem or not.
Do you have any other suggestions?
Thanks again for your help.
Ed

"Tom Ogilvy" wrote:

Sub Red()
Range("F9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

would be what i would try if your cells contains percentages.

Also, if you are only working with the activecell, why select more than

one
cell.

--
Regards,
Tom Ogilvy


"Ed P" wrote in message
...
Can someone help me determine what is wrong with the following code.
I am needing to change the color of the text in a cell to red if the

cell
is
100%.
My code I have currently is follows.

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 100 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

I appreciate any help you can give me.
If I am taking the wrong approach please advise.
Thank You
Ed







Tom Ogilvy

Comditional Formatting Problem
 
Right click on the sheet tab and select view code. Put in code like this.

Private Sub Worksheet_Calculate()
With Range("F9:G9")
If IsError(.Item(1, 1).Value) Then
.Font.ColorIndex = xlAutomatic
Else
If .Item(1, 1).Value 1 Then
.Font.ColorIndex = 3
Else
.Font.ColorIndex = 4
End If
End If
End With
End Sub

--
Regards,
Tom Ogilvy

"Ed P" wrote in message
...
Tom,
With your suggestion I have discoverd that the problem is not laying

within
my code but rather the execution of the code.
I need this macro to run anytime the cell reaches 100.01%.
Do you have any suggestions for this.
We are taking a step in the right direction.
I appreciate your help on this.
Thank You
Ed

"Tom Ogilvy" wrote:

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

worked fine for me with F9:G9 merged.

cell was formatted as percentage and was displaying 101%

from the immediate window you can see the actual value stored in the

cell:

? ActiveCell.Value
1.01

I guess you need to see what value is actually stored in the cell.

Sub Red()
Range("F9:G9").Select
MsgBox "Value: " & ActiveCell.Value & _
" Display: " & ActiveCell.Text
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

--
Regards,
Tom Ogilvy



"Ed P" wrote in message
...
Tom,
I apprecaite your help.
I have entered the Code as you instructed, but it still is not working
correctly.
I had originally chose 2 cells because those cells are merged. I am

not
sure
if this is the problem or not.
Do you have any other suggestions?
Thanks again for your help.
Ed

"Tom Ogilvy" wrote:

Sub Red()
Range("F9").Select
If ActiveCell.Value 1 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

would be what i would try if your cells contains percentages.

Also, if you are only working with the activecell, why select more

than
one
cell.

--
Regards,
Tom Ogilvy


"Ed P" wrote in message
...
Can someone help me determine what is wrong with the following

code.
I am needing to change the color of the text in a cell to red if

the
cell
is
100%.
My code I have currently is follows.

Sub Red()
Range("F9:G9").Select
If ActiveCell.Value 100 Then
ActiveCell.Font.ColorIndex = 3
End If
End Sub

I appreciate any help you can give me.
If I am taking the wrong approach please advise.
Thank You
Ed









bgpip - ExcelForums.com

Comditional Formatting Problem
 
I need to format cells for the font to change color depending on how
the number relates to another cell on the row. I am using
Format/Conditional. When I use the Paste Format function, the
orginal comparing cell from the original row is reflected instead of
the appropriate row's cell. How do I copy the format so it reflects
each individual row's criteria? I appreciate your help! ~
Barbara[quote:bfa81e434e][/quote:bfa81e434e]


Tim Williams

Comditional Formatting Problem
 
Make sure any cell references in your condition are relative (eg.
"A1") and not absolute ("$A1$")

They should then automatically adjust when pasted.

Tim.


"bgpip - ExcelForums.com"
wrote in message ...
I need to format cells for the font to change color depending on how
the number relates to another cell on the row. I am using
Format/Conditional. When I use the Paste Format function, the
orginal comparing cell from the original row is reflected instead of
the appropriate row's cell. How do I copy the format so it reflects
each individual row's criteria? I appreciate your help! ~
Barbara[quote:bfa81e434e][/quote:bfa81e434e]





All times are GMT +1. The time now is 05:18 PM.

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