Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default 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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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





  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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






  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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










  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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]

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default 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]



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting Problem John Calder New Users to Excel 2 April 6th 09 01:01 PM
formatting problem Beth[_2_] Excel Discussion (Misc queries) 3 July 30th 08 03:39 AM
csv to xls formatting problem [email protected] Excel Discussion (Misc queries) 1 October 10th 06 11:58 AM
formatting problem srv5uk Excel Discussion (Misc queries) 1 July 7th 05 07:28 PM
Formatting problem Henry Excel Discussion (Misc queries) 11 June 25th 05 01:20 AM


All times are GMT +1. The time now is 09:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"