i need help on a program i am writing

E

exor

I need to know how I can change the fill color of a range.

Now that is the simple part.

But I need to make a function so that it can be changed by two
different cells.

One cell will change it one color the other cell will change it
another color.

Example: in row three cell a3 has the word "pending"(pending can be in
ne row) in it. Since a3 = pending the color of the row (range from a3
to q3) is yellow (row).
If a3 <> "pending" its white (row) also if a3 = e or d color the row
(range from a3 to q3) red (row)
Now if c3 = "yes" then change the row (range from a3 to q3) color to
green if it is no leave row alone.

Also this can happen in ne row so and must be row specific.

i can make it it hapen but not be row specific

i could use ne help please.

thanks

exor
 
S

ShaneDevenshire

Hi,

Your conditions are not exclusive - in other words if A3 <> "Pending" color
it white and if A3 = e color it red! If the cell has e in it it is also
<>Pending??
 
S

ShaneDevenshire

Hi,

Here is some sample code

Sub ColorCells()
Dim cell As Range
For Each cell In Selection
With Range(cell, cell.Offset(0, 13)).Interior
Select Case cell
Case "pending"
.ColorIndex = 6
Case "yes"
.ColorIndex = 2
Case "e"
.ColorIndex = 3
Case Is <> "pending"
.ColorIndex = 50
End Select
End With
Next cell
End Sub

In addition to what I stated before:
1. setting a cell to white is different than not filling it with a color
2. this macro will color blank cells because they are <> pending
3. as written this code is case insensitive, if this is not what you want
you need to modify the code

To run this macro just select the cells in column A that you want to test
and choose Tools, Macro, Macros, pick the macro and click Run.
 
E

exor

Hi,

Here is some sample code

Sub ColorCells()
    Dim cell As Range
    For Each cell In Selection
        With Range(cell, cell.Offset(0, 13)).Interior
            Select Case cell
                Case "pending"
                    .ColorIndex = 6
                Case "yes"
                    .ColorIndex = 2
                Case "e"
                    .ColorIndex = 3
                Case Is <> "pending"
                    .ColorIndex = 50
            End Select
        End With
    Next cell
End Sub

In addition to what I stated before:
1.  setting a cell to white is different than not filling it with a color
2.  this macro will color blank cells because they are <> pending
3.  as written this code is case insensitive, if this is not what you want
you need to modify the code

To run this macro just select the cells in column A that you want to test
and choose Tools, Macro, Macros, pick the macro and click Run.
--
Thanks,
Shane Devenshire












- Show quoted text -

thank you shane

it show me alot i can mod this to what i need.
 

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

Top