PC Review


Reply
Thread Tools Rate Thread

Conditional Formatting More Than 3 Items

 
 
stevedemo77
Guest
Posts: n/a
 
      29th Jul 2009
I have a worksheet with data in A27:O250, and I need to color code each
individual row based on the value in column C of that row. There will be at
least 6-8 different values in column C from which I need to base the row
color from, so conditional formatting won't work. Any help is greatly
appreciated!

Thanks
 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      29th Jul 2009
Can you give us a hint what those 6-8 different values might be (or look
like)? And are you saying you will not know in advance how many different
values there might be? If so, is there a maximum number of different values
possible? Also, I'm guessing you will want a different color for each
different value, right?

--
Rick (MVP - Excel)


"stevedemo77" <(E-Mail Removed)> wrote in message
news:A6E146A9-5484-4902-8929-(E-Mail Removed)...
>I have a worksheet with data in A27:O250, and I need to color code each
> individual row based on the value in column C of that row. There will be
> at
> least 6-8 different values in column C from which I need to base the row
> color from, so conditional formatting won't work. Any help is greatly
> appreciated!
>
> Thanks


 
Reply With Quote
 
stevedemo77
Guest
Posts: n/a
 
      29th Jul 2009
Yes, the values are: ACT, BLD, BUD, CV, CVA, IRL, REV, and each one would
have a different color, and if it were any other value there would be no
color needed. This should be the entire list of possible values. Thanks!

"Rick Rothstein" wrote:

> Can you give us a hint what those 6-8 different values might be (or look
> like)? And are you saying you will not know in advance how many different
> values there might be? If so, is there a maximum number of different values
> possible? Also, I'm guessing you will want a different color for each
> different value, right?
>
> --
> Rick (MVP - Excel)
>
>
> "stevedemo77" <(E-Mail Removed)> wrote in message
> news:A6E146A9-5484-4902-8929-(E-Mail Removed)...
> >I have a worksheet with data in A27:O250, and I need to color code each
> > individual row based on the value in column C of that row. There will be
> > at
> > least 6-8 different values in column C from which I need to base the row
> > color from, so conditional formatting won't work. Any help is greatly
> > appreciated!
> >
> > Thanks

>
>

 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      29th Jul 2009
Right-click on the tab of the Sheet that you need the code for. paste this
into the window that opens:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Dim vRngInput As Range
Set vRngInput = Intersect(Target, Range("A:Z")) '<---------change to suit
If vRngInput Is Nothing Then Exit Sub
On Error GoTo endit
Application.EnableEvents = False
For Each rng In vRngInput
'Determine the color
Select Case UCase(rng.Value)
Case Is = "ACT": Num = 10 'green
Case Is = "BLD": Num = 2 'black
Case Is = "BUD": Num = 5 'blue
Case Is = "CV": Num = 7 'magenta
Case Is = "CVA": Num = 46 'orange
Case Is = "IRL": Num = 3 'red
Case Is = "REV": Num = 4 '
End Select
'Apply the color
rng.Interior.ColorIndex = Num
Next rng
endit:
Application.EnableEvents = True
End Sub

Here is a list of excel colors:
http://www.mvps.org/dmcritchie/excel/colors.htm

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"stevedemo77" wrote:

> Yes, the values are: ACT, BLD, BUD, CV, CVA, IRL, REV, and each one would
> have a different color, and if it were any other value there would be no
> color needed. This should be the entire list of possible values. Thanks!
>
> "Rick Rothstein" wrote:
>
> > Can you give us a hint what those 6-8 different values might be (or look
> > like)? And are you saying you will not know in advance how many different
> > values there might be? If so, is there a maximum number of different values
> > possible? Also, I'm guessing you will want a different color for each
> > different value, right?
> >
> > --
> > Rick (MVP - Excel)
> >
> >
> > "stevedemo77" <(E-Mail Removed)> wrote in message
> > news:A6E146A9-5484-4902-8929-(E-Mail Removed)...
> > >I have a worksheet with data in A27:O250, and I need to color code each
> > > individual row based on the value in column C of that row. There will be
> > > at
> > > least 6-8 different values in column C from which I need to base the row
> > > color from, so conditional formatting won't work. Any help is greatly
> > > appreciated!
> > >
> > > Thanks

> >
> >

 
Reply With Quote
 
stevedemo77
Guest
Posts: n/a
 
      29th Jul 2009
Is there something else I need to do besides change the range? This doesn't
appear to do anything.

"ryguy7272" wrote:

> Right-click on the tab of the Sheet that you need the code for. paste this
> into the window that opens:
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> Dim Num As Long
> Dim rng As Range
> Dim vRngInput As Range
> Set vRngInput = Intersect(Target, Range("A:Z")) '<---------change to suit
> If vRngInput Is Nothing Then Exit Sub
> On Error GoTo endit
> Application.EnableEvents = False
> For Each rng In vRngInput
> 'Determine the color
> Select Case UCase(rng.Value)
> Case Is = "ACT": Num = 10 'green
> Case Is = "BLD": Num = 2 'black
> Case Is = "BUD": Num = 5 'blue
> Case Is = "CV": Num = 7 'magenta
> Case Is = "CVA": Num = 46 'orange
> Case Is = "IRL": Num = 3 'red
> Case Is = "REV": Num = 4 '
> End Select
> 'Apply the color
> rng.Interior.ColorIndex = Num
> Next rng
> endit:
> Application.EnableEvents = True
> End Sub
>
> Here is a list of excel colors:
> http://www.mvps.org/dmcritchie/excel/colors.htm
>
> HTH,
> Ryan---
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "stevedemo77" wrote:
>
> > Yes, the values are: ACT, BLD, BUD, CV, CVA, IRL, REV, and each one would
> > have a different color, and if it were any other value there would be no
> > color needed. This should be the entire list of possible values. Thanks!
> >
> > "Rick Rothstein" wrote:
> >
> > > Can you give us a hint what those 6-8 different values might be (or look
> > > like)? And are you saying you will not know in advance how many different
> > > values there might be? If so, is there a maximum number of different values
> > > possible? Also, I'm guessing you will want a different color for each
> > > different value, right?
> > >
> > > --
> > > Rick (MVP - Excel)
> > >
> > >
> > > "stevedemo77" <(E-Mail Removed)> wrote in message
> > > news:A6E146A9-5484-4902-8929-(E-Mail Removed)...
> > > >I have a worksheet with data in A27:O250, and I need to color code each
> > > > individual row based on the value in column C of that row. There will be
> > > > at
> > > > least 6-8 different values in column C from which I need to base the row
> > > > color from, so conditional formatting won't work. Any help is greatly
> > > > appreciated!
> > > >
> > > > Thanks
> > >
> > >

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      29th Jul 2009
The code Ryan posted works automatically (similar to how Conditional
Formatting would have)... type one of your codes into a cell within the
range you changed the example Range("A:Z") to and it should become colored
in (with the exception maybe of BLD since Black, on my system is showing as
white).

--
Rick (MVP - Excel)


"stevedemo77" <(E-Mail Removed)> wrote in message
news:22A59D1F-320E-487B-9988-(E-Mail Removed)...
> Is there something else I need to do besides change the range? This
> doesn't
> appear to do anything.
>
> "ryguy7272" wrote:
>
>> Right-click on the tab of the Sheet that you need the code for. paste
>> this
>> into the window that opens:
>>
>> Private Sub Worksheet_Change(ByVal Target As Range)
>> Dim Num As Long
>> Dim rng As Range
>> Dim vRngInput As Range
>> Set vRngInput = Intersect(Target, Range("A:Z")) '<---------change to suit
>> If vRngInput Is Nothing Then Exit Sub
>> On Error GoTo endit
>> Application.EnableEvents = False
>> For Each rng In vRngInput
>> 'Determine the color
>> Select Case UCase(rng.Value)
>> Case Is = "ACT": Num = 10 'green
>> Case Is = "BLD": Num = 2 'black
>> Case Is = "BUD": Num = 5 'blue
>> Case Is = "CV": Num = 7 'magenta
>> Case Is = "CVA": Num = 46 'orange
>> Case Is = "IRL": Num = 3 'red
>> Case Is = "REV": Num = 4 '
>> End Select
>> 'Apply the color
>> rng.Interior.ColorIndex = Num
>> Next rng
>> endit:
>> Application.EnableEvents = True
>> End Sub
>>
>> Here is a list of excel colors:
>> http://www.mvps.org/dmcritchie/excel/colors.htm
>>
>> HTH,
>> Ryan---
>>
>> --
>> Ryan---
>> If this information was helpful, please indicate this by clicking
>> ''Yes''.
>>
>>
>> "stevedemo77" wrote:
>>
>> > Yes, the values are: ACT, BLD, BUD, CV, CVA, IRL, REV, and each one
>> > would
>> > have a different color, and if it were any other value there would be
>> > no
>> > color needed. This should be the entire list of possible values.
>> > Thanks!
>> >
>> > "Rick Rothstein" wrote:
>> >
>> > > Can you give us a hint what those 6-8 different values might be (or
>> > > look
>> > > like)? And are you saying you will not know in advance how many
>> > > different
>> > > values there might be? If so, is there a maximum number of different
>> > > values
>> > > possible? Also, I'm guessing you will want a different color for each
>> > > different value, right?
>> > >
>> > > --
>> > > Rick (MVP - Excel)
>> > >
>> > >
>> > > "stevedemo77" <(E-Mail Removed)> wrote in
>> > > message
>> > > news:A6E146A9-5484-4902-8929-(E-Mail Removed)...
>> > > >I have a worksheet with data in A27:O250, and I need to color code
>> > > >each
>> > > > individual row based on the value in column C of that row. There
>> > > > will be
>> > > > at
>> > > > least 6-8 different values in column C from which I need to base
>> > > > the row
>> > > > color from, so conditional formatting won't work. Any help is
>> > > > greatly
>> > > > appreciated!
>> > > >
>> > > > Thanks
>> > >
>> > >


 
Reply With Quote
 
stevedemo77
Guest
Posts: n/a
 
      29th Jul 2009
Strange...still not working. I must be missing something.

"Rick Rothstein" wrote:

> The code Ryan posted works automatically (similar to how Conditional
> Formatting would have)... type one of your codes into a cell within the
> range you changed the example Range("A:Z") to and it should become colored
> in (with the exception maybe of BLD since Black, on my system is showing as
> white).
>
> --
> Rick (MVP - Excel)
>
>
> "stevedemo77" <(E-Mail Removed)> wrote in message
> news:22A59D1F-320E-487B-9988-(E-Mail Removed)...
> > Is there something else I need to do besides change the range? This
> > doesn't
> > appear to do anything.
> >
> > "ryguy7272" wrote:
> >
> >> Right-click on the tab of the Sheet that you need the code for. paste
> >> this
> >> into the window that opens:
> >>
> >> Private Sub Worksheet_Change(ByVal Target As Range)
> >> Dim Num As Long
> >> Dim rng As Range
> >> Dim vRngInput As Range
> >> Set vRngInput = Intersect(Target, Range("A:Z")) '<---------change to suit
> >> If vRngInput Is Nothing Then Exit Sub
> >> On Error GoTo endit
> >> Application.EnableEvents = False
> >> For Each rng In vRngInput
> >> 'Determine the color
> >> Select Case UCase(rng.Value)
> >> Case Is = "ACT": Num = 10 'green
> >> Case Is = "BLD": Num = 2 'black
> >> Case Is = "BUD": Num = 5 'blue
> >> Case Is = "CV": Num = 7 'magenta
> >> Case Is = "CVA": Num = 46 'orange
> >> Case Is = "IRL": Num = 3 'red
> >> Case Is = "REV": Num = 4 '
> >> End Select
> >> 'Apply the color
> >> rng.Interior.ColorIndex = Num
> >> Next rng
> >> endit:
> >> Application.EnableEvents = True
> >> End Sub
> >>
> >> Here is a list of excel colors:
> >> http://www.mvps.org/dmcritchie/excel/colors.htm
> >>
> >> HTH,
> >> Ryan---
> >>
> >> --
> >> Ryan---
> >> If this information was helpful, please indicate this by clicking
> >> ''Yes''.
> >>
> >>
> >> "stevedemo77" wrote:
> >>
> >> > Yes, the values are: ACT, BLD, BUD, CV, CVA, IRL, REV, and each one
> >> > would
> >> > have a different color, and if it were any other value there would be
> >> > no
> >> > color needed. This should be the entire list of possible values.
> >> > Thanks!
> >> >
> >> > "Rick Rothstein" wrote:
> >> >
> >> > > Can you give us a hint what those 6-8 different values might be (or
> >> > > look
> >> > > like)? And are you saying you will not know in advance how many
> >> > > different
> >> > > values there might be? If so, is there a maximum number of different
> >> > > values
> >> > > possible? Also, I'm guessing you will want a different color for each
> >> > > different value, right?
> >> > >
> >> > > --
> >> > > Rick (MVP - Excel)
> >> > >
> >> > >
> >> > > "stevedemo77" <(E-Mail Removed)> wrote in
> >> > > message
> >> > > news:A6E146A9-5484-4902-8929-(E-Mail Removed)...
> >> > > >I have a worksheet with data in A27:O250, and I need to color code
> >> > > >each
> >> > > > individual row based on the value in column C of that row. There
> >> > > > will be
> >> > > > at
> >> > > > least 6-8 different values in column C from which I need to base
> >> > > > the row
> >> > > > color from, so conditional formatting won't work. Any help is
> >> > > > greatly
> >> > > > appreciated!
> >> > > >
> >> > > > Thanks
> >> > >
> >> > >

>
>

 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      29th Jul 2009
Paste that code behind the sheet (right-click the sheet and paste into the
window that opens). Then go back to the sheet and type ACT into Cell A1.
What happens?

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"stevedemo77" wrote:

> Strange...still not working. I must be missing something.
>
> "Rick Rothstein" wrote:
>
> > The code Ryan posted works automatically (similar to how Conditional
> > Formatting would have)... type one of your codes into a cell within the
> > range you changed the example Range("A:Z") to and it should become colored
> > in (with the exception maybe of BLD since Black, on my system is showing as
> > white).
> >
> > --
> > Rick (MVP - Excel)
> >
> >
> > "stevedemo77" <(E-Mail Removed)> wrote in message
> > news:22A59D1F-320E-487B-9988-(E-Mail Removed)...
> > > Is there something else I need to do besides change the range? This
> > > doesn't
> > > appear to do anything.
> > >
> > > "ryguy7272" wrote:
> > >
> > >> Right-click on the tab of the Sheet that you need the code for. paste
> > >> this
> > >> into the window that opens:
> > >>
> > >> Private Sub Worksheet_Change(ByVal Target As Range)
> > >> Dim Num As Long
> > >> Dim rng As Range
> > >> Dim vRngInput As Range
> > >> Set vRngInput = Intersect(Target, Range("A:Z")) '<---------change to suit
> > >> If vRngInput Is Nothing Then Exit Sub
> > >> On Error GoTo endit
> > >> Application.EnableEvents = False
> > >> For Each rng In vRngInput
> > >> 'Determine the color
> > >> Select Case UCase(rng.Value)
> > >> Case Is = "ACT": Num = 10 'green
> > >> Case Is = "BLD": Num = 2 'black
> > >> Case Is = "BUD": Num = 5 'blue
> > >> Case Is = "CV": Num = 7 'magenta
> > >> Case Is = "CVA": Num = 46 'orange
> > >> Case Is = "IRL": Num = 3 'red
> > >> Case Is = "REV": Num = 4 '
> > >> End Select
> > >> 'Apply the color
> > >> rng.Interior.ColorIndex = Num
> > >> Next rng
> > >> endit:
> > >> Application.EnableEvents = True
> > >> End Sub
> > >>
> > >> Here is a list of excel colors:
> > >> http://www.mvps.org/dmcritchie/excel/colors.htm
> > >>
> > >> HTH,
> > >> Ryan---
> > >>
> > >> --
> > >> Ryan---
> > >> If this information was helpful, please indicate this by clicking
> > >> ''Yes''.
> > >>
> > >>
> > >> "stevedemo77" wrote:
> > >>
> > >> > Yes, the values are: ACT, BLD, BUD, CV, CVA, IRL, REV, and each one
> > >> > would
> > >> > have a different color, and if it were any other value there would be
> > >> > no
> > >> > color needed. This should be the entire list of possible values.
> > >> > Thanks!
> > >> >
> > >> > "Rick Rothstein" wrote:
> > >> >
> > >> > > Can you give us a hint what those 6-8 different values might be (or
> > >> > > look
> > >> > > like)? And are you saying you will not know in advance how many
> > >> > > different
> > >> > > values there might be? If so, is there a maximum number of different
> > >> > > values
> > >> > > possible? Also, I'm guessing you will want a different color for each
> > >> > > different value, right?
> > >> > >
> > >> > > --
> > >> > > Rick (MVP - Excel)
> > >> > >
> > >> > >
> > >> > > "stevedemo77" <(E-Mail Removed)> wrote in
> > >> > > message
> > >> > > news:A6E146A9-5484-4902-8929-(E-Mail Removed)...
> > >> > > >I have a worksheet with data in A27:O250, and I need to color code
> > >> > > >each
> > >> > > > individual row based on the value in column C of that row. There
> > >> > > > will be
> > >> > > > at
> > >> > > > least 6-8 different values in column C from which I need to base
> > >> > > > the row
> > >> > > > color from, so conditional formatting won't work. Any help is
> > >> > > > greatly
> > >> > > > appreciated!
> > >> > > >
> > >> > > > Thanks
> > >> > >
> > >> > >

> >
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting of text effecting formatting of background =?Utf-8?B?SEFI?= Microsoft Access Reports 6 25th Mar 2008 06:23 PM
Conditional Formatting No Longer Conditional in 2007 Beta =?Utf-8?B?Q2FjdHVhci1Oby1KdXRzdQ==?= Microsoft Excel Crashes 0 17th Nov 2006 10:01 PM
I would like to use conditional formatting for 4 or more items. =?Utf-8?B?SW5nZQ==?= Microsoft Excel Misc 4 27th Aug 2006 06:34 PM
How do I do a complex conditional in a conditional formatting formula Ray Stevens Microsoft Excel Discussion 7 12th Mar 2006 10:24 PM
Conditional Formatting that will display conditional data =?Utf-8?B?QnJhaW5GYXJ0?= Microsoft Excel Worksheet Functions 1 13th Sep 2005 05:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:39 AM.