Conditional Formating

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to get a conditonal format to run in my macro.
I need to get the following conditional format on each row (from 4 down)
between Columns E and O: "=AND($E4>74,$E4<90,$C4>0)" (.Interior.ColorIndex
= 36)

On Row 5 I Need the same only referencing row 5 instead of 4.

I need this conditional format input all the way down to the last row of
data (in column E).

When I am done it should highlight, for example, E4:O4 the specified color
if E4 is greater than 74 and less than 90...

How can I do this?
 
Select E4 down to O and target row.

Go to CF and enter that formula.
 
I am trying to avoid having to do this action for every report. I need a
macro that will automate this task for me. The range from E4:O4 is where the
format needs to begin. The last row will be different for every report that
runs...sometimes is will be row 50 sometimes is could be as high as 10000.
 
Modify the following code with the correct ranges

Sheet1.Range("E4").Select
With Sheet1.Range("E4:O4").FormatConditions
.Delete
.Add(xlExpression, ,
"=AND($E4>74,$E4<90,$C4>0)").Interior.ColorIndex = 36
End With

With Sheet1.Range("E4:O4")
.Copy
Sheet1.Range("E5").Select
Sheet1.Range("E5:O100").PasteSpecial xlPasteFormats
End With

Alok Joshi
 
Here is some simpler code for doing the same thing. I do not know why I was
doing it in two steps!!

Sheet1.Range("E4:O100").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add(xlExpression, ,
"=AND($E4>74,$E4<90,$C4>0)").Interior.ColorIndex = 36

Alok Joshi
 
Thanks. I had a hard time with the syntax.

Alok said:
Modify the following code with the correct ranges

Sheet1.Range("E4").Select
With Sheet1.Range("E4:O4").FormatConditions
.Delete
.Add(xlExpression, ,
"=AND($E4>74,$E4<90,$C4>0)").Interior.ColorIndex = 36
End With

With Sheet1.Range("E4:O4")
.Copy
Sheet1.Range("E5").Select
Sheet1.Range("E5:O100").PasteSpecial xlPasteFormats
End With

Alok Joshi
 

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

Back
Top