Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-09-2008, 04:01 PM
@Homeonthecouch
 
Posts: n/a
Conditional colours in Lookup table

Hello,
I have a table that reports results from a lookup table.
The results are in column "L"
I am wanting specifics to be highlighted.
If a cell reports "sam" or "jim" to be blue etc.

Thanks in advance

Andrew




Reply With Quote
  #2 (permalink)  
Old 05-09-2008, 05:10 PM
Dave Peterson
 
Posts: n/a
Re: Conditional colours in Lookup table

Have you looked at Conditional formatting?

In xl2003 menus:
Format|conditional formatting

"@Homeonthecouch" wrote:
>
> Hello,
> I have a table that reports results from a lookup table.
> The results are in column "L"
> I am wanting specifics to be highlighted.
> If a cell reports "sam" or "jim" to be blue etc.
>
> Thanks in advance
>
> Andrew


--

Dave Peterson
Reply With Quote
  #3 (permalink)  
Old 05-10-2008, 01:21 AM
@Homeonthecouch
 
Posts: n/a
Re: Conditional colours in Lookup table

Yeah I didn't explain that I want to use more than 3 colours and require the VB script did I?

So the conditional formatting doesn't offer enough choice.

Again Any help is appreciated.

Andrew

"Dave Peterson" <petersod@verizonXSPAM.net> wrote in message news:4824777D.8F038A0@verizonXSPAM.net...
Have you looked at Conditional formatting?

In xl2003 menus:
Format|conditional formatting

"@Homeonthecouch" wrote:
>
> Hello,
> I have a table that reports results from a lookup table.
> The results are in column "L"
> I am wanting specifics to be highlighted.
> If a cell reports "sam" or "jim" to be blue etc.
>
> Thanks in advance
>
> Andrew


--

Dave Peterson


Reply With Quote
  #4 (permalink)  
Old 05-10-2008, 01:33 AM
Gord Dibben
 
Posts: n/a
Re: Conditional colours in Lookup table

Try this event code.

Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1:A20")
If Intersect(Target, r) Is Nothing Then
Exit Sub
End If
On Error GoTo Endit
Application.EnableEvents = False
vals = Array("Cat", "Dog", "Gopher", "Hyena", "Ibex", "Lynx", _
"Ocelot", "Skunk", "Tiger", "Yak")
nums = Array(8, 9, 6, 3, 7, 4, 20, 10, 23, 15)
For Each rr In r
icolor = 0
For i = LBound(vals) To UBound(vals)
If rr.Value = vals(i) Then
icolor = nums(i)
End If
Next
If icolor <> 0 Then
rr.Interior.ColorIndex = icolor
End If
Next
Endit:
Application.EnableEvents = True
End Sub

Right-click on the sheet tab and "View Code".. Copy/paste to that sheet module.

Edit then Alt + q to freturn to the Excel window.

As an alternative.............Bob Phillips has a CFPLUS add-in that allows up to
30 CF's in a cell.

http://www.xldynamic.com/source/xld.....Download.html


Gord Dibben MS Excel MVP

On Sat, 10 May 2008 01:21:17 +0100, "@Homeonthecouch" <me@home.com> wrote:

>Yeah I didn't explain that I want to use more than 3 colours and require the VB script did I?
>
>So the conditional formatting doesn't offer enough choice.
>
>Again Any help is appreciated.
>
>Andrew
>
>"Dave Peterson" <petersod@verizonXSPAM.net> wrote in message news:4824777D.8F038A0@verizonXSPAM.net...
>Have you looked at Conditional formatting?
>
>In xl2003 menus:
>Format|conditional formatting
>
>"@Homeonthecouch" wrote:
>>
>> Hello,
>> I have a table that reports results from a lookup table.
>> The results are in column "L"
>> I am wanting specifics to be highlighted.
>> If a cell reports "sam" or "jim" to be blue etc.
>>
>> Thanks in advance
>>
>> Andrew


Reply With Quote
  #5 (permalink)  
Old 05-10-2008, 08:08 AM
@Homeonthecouch
 
Posts: n/a
Re: Conditional colours in Lookup table

Thanks Gord,

That works a treat, I tried the download from the link too but wasn't happy with it.
If I wanted to also make the text bold and white could this be added into the event code you submitted?

Once again thanks for your help already.

Andrew


"Gord Dibben" <gorddibbATshawDOTca> wrote in message news:rar924pjljm08vm5167odoa4lc1t653g6a@4ax.com...
Try this event code.

Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1:A20")
If Intersect(Target, r) Is Nothing Then
Exit Sub
End If
On Error GoTo Endit
Application.EnableEvents = False
vals = Array("Cat", "Dog", "Gopher", "Hyena", "Ibex", "Lynx", _
"Ocelot", "Skunk", "Tiger", "Yak")
nums = Array(8, 9, 6, 3, 7, 4, 20, 10, 23, 15)
For Each rr In r
icolor = 0
For i = LBound(vals) To UBound(vals)
If rr.Value = vals(i) Then
icolor = nums(i)
End If
Next
If icolor <> 0 Then
rr.Interior.ColorIndex = icolor
End If
Next
Endit:
Application.EnableEvents = True
End Sub

Right-click on the sheet tab and "View Code".. Copy/paste to that sheet module.

Edit then Alt + q to freturn to the Excel window.

As an alternative.............Bob Phillips has a CFPLUS add-in that allows up to
30 CF's in a cell.

http://www.xldynamic.com/source/xld.....Download.html


Gord Dibben MS Excel MVP

On Sat, 10 May 2008 01:21:17 +0100, "@Homeonthecouch" <me@home.com> wrote:

>Yeah I didn't explain that I want to use more than 3 colours and require the VB script did I?
>
>So the conditional formatting doesn't offer enough choice.
>
>Again Any help is appreciated.
>
>Andrew
>
>"Dave Peterson" <petersod@verizonXSPAM.net> wrote in message news:4824777D.8F038A0@verizonXSPAM.net...
>Have you looked at Conditional formatting?
>
>In xl2003 menus:
>Format|conditional formatting
>
>"@Homeonthecouch" wrote:
>>
>> Hello,
>> I have a table that reports results from a lookup table.
>> The results are in column "L"
>> I am wanting specifics to be highlighted.
>> If a cell reports "sam" or "jim" to be blue etc.
>>
>> Thanks in advance
>>
>> Andrew



Reply With Quote
  #6 (permalink)  
Old 05-10-2008, 06:01 PM
Gord Dibben
 
Posts: n/a
Re: Conditional colours in Lookup table

Make changes as such...............

Next
If icolor <> 0 Then
With rr
.Interior.ColorIndex = icolor
.Font.ColorIndex = 2
.Font.Bold = True
End With
End If
Next


Gord

On Sat, 10 May 2008 08:08:19 +0100, "@Homeonthecouch" <me@home.com> wrote:

>Thanks Gord,
>
>That works a treat, I tried the download from the link too but wasn't happy with it.
>If I wanted to also make the text bold and white could this be added into the event code you submitted?
>
>Once again thanks for your help already.
>
>Andrew
>
>
>"Gord Dibben" <gorddibbATshawDOTca> wrote in message news:rar924pjljm08vm5167odoa4lc1t653g6a@4ax.com...
>Try this event code.
>
>Option Compare Text
>Private Sub Worksheet_Change(ByVal Target As Range)
>Set r = Range("A1:A20")
>If Intersect(Target, r) Is Nothing Then
> Exit Sub
>End If
>On Error GoTo Endit
>Application.EnableEvents = False
>vals = Array("Cat", "Dog", "Gopher", "Hyena", "Ibex", "Lynx", _
>"Ocelot", "Skunk", "Tiger", "Yak")
>nums = Array(8, 9, 6, 3, 7, 4, 20, 10, 23, 15)
>For Each rr In r
> icolor = 0
> For i = LBound(vals) To UBound(vals)
> If rr.Value = vals(i) Then
> icolor = nums(i)
> End If
> Next
> If icolor <> 0 Then
> rr.Interior.ColorIndex = icolor
> End If
>Next
>Endit:
>Application.EnableEvents = True
>End Sub
>
>Right-click on the sheet tab and "View Code".. Copy/paste to that sheet module.
>
>Edit then Alt + q to freturn to the Excel window.
>
>As an alternative.............Bob Phillips has a CFPLUS add-in that allows up to
>30 CF's in a cell.
>
>http://www.xldynamic.com/source/xld.....Download.html
>
>
>Gord Dibben MS Excel MVP
>
>On Sat, 10 May 2008 01:21:17 +0100, "@Homeonthecouch" <me@home.com> wrote:
>
>>Yeah I didn't explain that I want to use more than 3 colours and require the VB script did I?
>>
>>So the conditional formatting doesn't offer enough choice.
>>
>>Again Any help is appreciated.
>>
>>Andrew
>>
>>"Dave Peterson" <petersod@verizonXSPAM.net> wrote in message news:4824777D.8F038A0@verizonXSPAM.net...
>>Have you looked at Conditional formatting?
>>
>>In xl2003 menus:
>>Format|conditional formatting
>>
>>"@Homeonthecouch" wrote:
>>>
>>> Hello,
>>> I have a table that reports results from a lookup table.
>>> The results are in column "L"
>>> I am wanting specifics to be highlighted.
>>> If a cell reports "sam" or "jim" to be blue etc.
>>>
>>> Thanks in advance
>>>
>>> Andrew

>


Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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



All times are GMT. The time now is 05:01 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Modded Xbox | Refinance | Arcademare Arcade games and movies | Loans | Mobile Phone



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114