find and then change font colour excel 2002

anon125

Active Member
Joined
Feb 14, 2008
Messages
392
we have a grid of 25 by 25 cells
the cells have words in them.
I can find say 'garden' and find them all.
how do i change the font colour for all of the garden ones?

and the same for other cells with another word in them.

is it simple? for me i sure hope so!

thanks all
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
different font colour for each - as many as possible!
thanks
Then you won't be able to use Conditional Formatting as your Excel version only allows 3 different formats with CF.
Here is an extension of the idea given by Alan in post 2. Your range of 25 x 25 is not very big but if you were to apply this to a very large range, a different approach might be warranted, depending on how many of each value you might expect to find in that range.

VBA Code:
Sub Colour_Values()
  Dim c As Range
  Dim Vals_To_Colour As Variant, Colour_Vals As Variant
  Dim i As Long
 
  Vals_To_Colour = Split(LCase("Garden|Gate|Shed"), "|")
  Colour_Vals = Split("3|5|10", "|")
  If UBound(Vals_To_Colour) = UBound(Colour_Vals) Then
    Application.ScreenUpdating = False
    For i = 0 To UBound(Vals_To_Colour)
      For Each c In Range("A1:Y25")
        If LCase(c.Value) = Vals_To_Colour(i) Then c.Font.ColorIndex = Colour_Vals(i)
      Next c
    Next i
    Application.ScreenUpdating = True
  Else
    MsgBox "Number of values and colours do not match"
  End If
End Sub
 
Upvote 0
i (mis) understood the link page to say the colours and numbers are not all the same from version to version.
thanks
 
Upvote 0
Oh, okay. Is that a problem, as the words would still show up as different colours?

If it is then you could do some research about copying the color palette from one workbook to another (mentioned in that same article) or perhaps investigate using

.Font.Color (& use RGB settings for the various colours that you want)
instead of
.Font.ColorIndex

Working with color palettes and color generally is not a strength of mine though.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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