VBA / Conditional Format

rickp

New Member
Joined
Apr 14, 2002
Messages
7
I have a workbook that has the salepeoples names in row r. I would like the whole row reflect a color based on that column. I want to assign each sales person a different colr (there are 4 right now). The column rows are a - r. I can do a conditional format for the cells in column r but would like the whole row. Any ideas?
This message was edited by rickp on 2002-05-09 11:20
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
On 2002-05-09 10:56, rickp wrote:
I have a workbook that has the salepeoples names in row r. I would like the whole row reflect a color based on that column. I want to assign each sales person a different colr (there are 4 right now). The column rows are a - r. I can do a conditional format for the cells in column r but would like the whole row. Any ideas?

A Conditional Format can affect a the format for an entire row; however, your bigger problem is that it only supports 3 conditions! What are you gonna do for the 4th Salesperson?
 
Upvote 0
I was hoping maybe a VB that would take care of the 4 sales people or maybe be able to handle more.
 
Upvote 0
On 2002-05-09 11:07, rickp wrote:
I was hoping maybe a VB that would take care of the 4 sales people or maybe be able to handle more.

VBA would. Perhaps you should post your problem as "VBA for..." rather than "Conditional Format".
This message was edited by Mark W. on 2002-05-09 11:11
 
Upvote 0
What cell is in the input, R_ ?

What are the inputs (names)? What are the colors respecitve colours? This can be done via worksheet_change.

We'll be waiting.

_________________
Cheers,<font size=+2><font color="red"> Nate<font color="blue">O</font></font></font>
wave.gif

This message was edited by NateO on 2002-05-09 11:35
 
Upvote 0
It starts at cell R5 ends R184, the names are susan , brian , tracy , jason .. the colors are blue , green , pink , purple .
 
Upvote 0
Almost there, you want:

R5 ends R184 highlighted based on which single cell that changes.

Or is it r5:ar5, r6:ar6, etc....Still which cell is the decision maker?
 
Upvote 0
Right-click on the sheet in question, click 'view code' and paste the following procedure:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, [r5:r184]) Is Nothing Then
    If Target.Value = "Susan" Or Target.Value = "susan" Then
    Target.EntireRow.Interior.ColorIndex = 5
    ElseIf Target.Value = "Brian" Or Target.Value = "brian" Then
    Target.EntireRow.Interior.ColorIndex = 4
    ElseIf Target.Value = "Tracy" Or Target.Value = "tracy" Then
    Target.EntireRow.Interior.ColorIndex = 7
    ElseIf Target.Value = "Jason" Or Target.Value = "jason" Then
    Target.EntireRow.Interior.ColorIndex = 21
    Else: Target.EntireRow.Interior.ColorIndex = xlNone
    End If
End If
End Sub

Might want to change Jason's color, he's a little dark (e.g., 21 to 6 or something).

Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,214,527
Messages
6,120,054
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top