PC Review


Reply
Thread Tools Rate Thread

Change Text Colour if Value is in a List Q

 
 
Sean
Guest
Posts: n/a
 
      24th Feb 2007
How would I change the Text colour of a cell to white (invisible) if
that Value in the cell is listed within a list?

For example I have a range of values in Sheet1 from A5:W30, if any of
these cells is contained within the list that is detailed on Sheet2
A1:A5, then I want to change those values in Sheet1 A5:W30 to White

Thanks

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      24th Feb 2007
Select Sheet2 A1:A5
Insert|Name
Call it
MyList

Select Sheet1 A5:W30
With A5 the activecell
Format|conditional formatting
Formula is:
=countif(myList,a5)>0

And give it a nice format (white on white)

Sean wrote:
>
> How would I change the Text colour of a cell to white (invisible) if
> that Value in the cell is listed within a list?
>
> For example I have a range of values in Sheet1 from A5:W30, if any of
> these cells is contained within the list that is detailed on Sheet2
> A1:A5, then I want to change those values in Sheet1 A5:W30 to White
>
> Thanks


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      24th Feb 2007
Try something like:

Sub set_color()
Set r1 = Sheets("Sheet1").Range("A5:W30")
Set r2 = Sheets("Sheet2").Range("A1:A5")

For Each r2i In r2
v = r2i.Value
For Each r1i In r1
If r1i.Value = v Then
r1i.Font.ColorIndex = 2
End If
Next
Next

End Sub
--
Gary's Student
gsnu200707


"Sean" wrote:

> How would I change the Text colour of a cell to white (invisible) if
> that Value in the cell is listed within a list?
>
> For example I have a range of values in Sheet1 from A5:W30, if any of
> these cells is contained within the list that is detailed on Sheet2
> A1:A5, then I want to change those values in Sheet1 A5:W30 to White
>
> Thanks
>
>

 
Reply With Quote
 
Sean
Guest
Posts: n/a
 
      24th Feb 2007
On Feb 24, 2:27 pm, Gary''s Student
<GarysStud...@discussions.microsoft.com> wrote:
> Try something like:
>
> Sub set_color()
> Set r1 = Sheets("Sheet1").Range("A5:W30")
> Set r2 = Sheets("Sheet2").Range("A1:A5")
>
> For Each r2i In r2
> v = r2i.Value
> For Each r1i In r1
> If r1i.Value = v Then
> r1i.Font.ColorIndex = 2
> End If
> Next
> Next
>
> End Sub
> --
> Gary's Student
> gsnu200707
>
>
>
> "Sean" wrote:
> > How would I change the Text colour of a cell to white (invisible) if
> > that Value in the cell is listed within a list?

>
> > For example I have a range of values in Sheet1 from A5:W30, if any of
> > these cells is contained within the list that is detailed on Sheet2
> > A1:A5, then I want to change those values in Sheet1 A5:W30 to White

>
> > Thanks- Hide quoted text -

>
> - Show quoted text -


Thanks guys for the 2 options

 
Reply With Quote
 
Sean
Guest
Posts: n/a
 
      24th Feb 2007
On Feb 24, 2:27 pm, Gary''s Student
<GarysStud...@discussions.microsoft.com> wrote:
> Try something like:
>
> Sub set_color()
> Set r1 = Sheets("Sheet1").Range("A5:W30")
> Set r2 = Sheets("Sheet2").Range("A1:A5")
>
> For Each r2i In r2
> v = r2i.Value
> For Each r1i In r1
> If r1i.Value = v Then
> r1i.Font.ColorIndex = 2
> End If
> Next
> Next
>
> End Sub
> --
> Gary's Student
> gsnu200707
>
>
>
> "Sean" wrote:
> > How would I change the Text colour of a cell to white (invisible) if
> > that Value in the cell is listed within a list?

>
> > For example I have a range of values in Sheet1 from A5:W30, if any of
> > these cells is contained within the list that is detailed on Sheet2
> > A1:A5, then I want to change those values in Sheet1 A5:W30 to White

>
> > Thanks- Hide quoted text -

>
> - Show quoted text -


Just a slight advancement on this. How would I add up the instance of
my "white values" in a range. Currently I use the formula below, which
looks for the value in A43 of how many times it appears in D9 to AG36,
but now I want to do the same but only if they are coloured white
text

=COUNTIF($D$9:$AG$36,A43)

Sorry if I have posted to wrong Group

 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      24th Feb 2007
Sub sean2()
Set r = Range("D9:AG36")
whitecount = 0
For Each rr In r
If rr.Font.ColorIndex = 2 Then
whitecount = whitecount + 1
End If
Next
MsgBox (whitecount)
End Sub
--
Gary''s Student
gsnu200707


"Sean" wrote:

> On Feb 24, 2:27 pm, Gary''s Student
> <GarysStud...@discussions.microsoft.com> wrote:
> > Try something like:
> >
> > Sub set_color()
> > Set r1 = Sheets("Sheet1").Range("A5:W30")
> > Set r2 = Sheets("Sheet2").Range("A1:A5")
> >
> > For Each r2i In r2
> > v = r2i.Value
> > For Each r1i In r1
> > If r1i.Value = v Then
> > r1i.Font.ColorIndex = 2
> > End If
> > Next
> > Next
> >
> > End Sub
> > --
> > Gary's Student
> > gsnu200707
> >
> >
> >
> > "Sean" wrote:
> > > How would I change the Text colour of a cell to white (invisible) if
> > > that Value in the cell is listed within a list?

> >
> > > For example I have a range of values in Sheet1 from A5:W30, if any of
> > > these cells is contained within the list that is detailed on Sheet2
> > > A1:A5, then I want to change those values in Sheet1 A5:W30 to White

> >
> > > Thanks- Hide quoted text -

> >
> > - Show quoted text -

>
> Just a slight advancement on this. How would I add up the instance of
> my "white values" in a range. Currently I use the formula below, which
> looks for the value in A43 of how many times it appears in D9 to AG36,
> but now I want to do the same but only if they are coloured white
> text
>
> =COUNTIF($D$9:$AG$36,A43)
>
> Sorry if I have posted to wrong Group
>
>

 
Reply With Quote
 
Sean
Guest
Posts: n/a
 
      24th Feb 2007
On Feb 24, 3:51 pm, Gary''s Student
<GarysStud...@discussions.microsoft.com> wrote:
> Sub sean2()
> Set r = Range("D9:AG36")
> whitecount = 0
> For Each rr In r
> If rr.Font.ColorIndex = 2 Then
> whitecount = whitecount + 1
> End If
> Next
> MsgBox (whitecount)
> End Sub
> --
> Gary''s Student
> gsnu200707
>
>
>
> "Sean" wrote:
> > On Feb 24, 2:27 pm, Gary''s Student
> > <GarysStud...@discussions.microsoft.com> wrote:
> > > Try something like:

>
> > > Sub set_color()
> > > Set r1 = Sheets("Sheet1").Range("A5:W30")
> > > Set r2 = Sheets("Sheet2").Range("A1:A5")

>
> > > For Each r2i In r2
> > > v = r2i.Value
> > > For Each r1i In r1
> > > If r1i.Value = v Then
> > > r1i.Font.ColorIndex = 2
> > > End If
> > > Next
> > > Next

>
> > > End Sub
> > > --
> > > Gary's Student
> > > gsnu200707

>
> > > "Sean" wrote:
> > > > How would I change the Text colour of a cell to white (invisible) if
> > > > that Value in the cell is listed within a list?

>
> > > > For example I have a range of values in Sheet1 from A5:W30, if any of
> > > > these cells is contained within the list that is detailed on Sheet2
> > > > A1:A5, then I want to change those values in Sheet1 A5:W30 to White

>
> > > > Thanks- Hide quoted text -

>
> > > - Show quoted text -

>
> > Just a slight advancement on this. How would I add up the instance of
> > my "white values" in a range. Currently I use the formula below, which
> > looks for the value in A43 of how many times it appears in D9 to AG36,
> > but now I want to do the same but only if they are coloured white
> > text

>
> > =COUNTIF($D$9:$AG$36,A43)

>
> > Sorry if I have posted to wrong Group- Hide quoted text -

>
> - Show quoted text -


Thanks Gary, not quite what I was looking for, although I now realise
there is no worksheet function based on cell text colour so you must
use VB. Your code will work but instead of getting a total of all
White text, I want a number of values returned in a cell, not a
message box. A43 in my formula is a value that appears in D9:AG36, so
I wish total the number of white instances of this value in the range
D9:AG36

 
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
Change text colour SimoninParis Microsoft Powerpoint 1 2nd Mar 2009 04:39 PM
How do I change the text colour in a drop down list? =?Utf-8?B?Qmx1ZXRvbmUxMDE=?= Microsoft Excel Misc 1 29th Oct 2007 03:41 PM
change text colour and size in text form field =?Utf-8?B?RGFuYQ==?= Microsoft Word Document Management 0 7th Apr 2006 10:29 PM
Text colour in task LIST for colour coding =?Utf-8?B?REVF?= Microsoft Outlook Discussion 3 30th May 2005 11:20 AM
List Box Text Colour Dave Microsoft Access Form Coding 1 9th Jul 2004 05:27 PM


Features
 

Advertising
 

Newsgroups
 


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