View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Sean Sean is offline
external usenet poster
 
Posts: 454
Default Change Text Colour if Value is in a List Q

On Feb 24, 2:27 pm, Gary''s Student
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