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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Here is a VBA solution for you.

VBA Code:
Option Explicit

Sub Garden()
    Dim c As Range, rng As Range
    Set rng = Range("A1:Y25")    'change this to reflect your range
    For Each c In rng
        If c = "Garden" Then    'change this to your lookup word
            c.Interior.ColorIndex = 6  'change this to the color you wish.
        End If
    Next c
End Sub
 
Upvote 0
Uusing Alan's assumed range and font color (change them to suit your needs), here is another macro that you can consider...
VBA Code:
Sub Garden()
  Application.ReplaceFormat.Clear
  Application.ReplaceFormat.Interior.ColorIndex = 6
  Range("A1:Y25").Replace "Garden", "", xlWhole, , False, , False, True
  Application.ReplaceFormat.Clear
End Sub
 
Upvote 0
Don't think Find/Replace format was available in Excel 2002 (XP). Not until Excel 2003 I think.
I never had XL2002, so I don't know (XL2003 was the earliest version I ever had). If you are right, then the OP will know why my code fails should he decide to try it.
 
Upvote 0
Xl 2003 had a limit of 3 CF rules, if I remember rightly. So I suspect it will be the same in 2002
 
Upvote 0
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.
Will the cells with the "other word" have the same font colour as 'Garden' or a different font colour for each word?

If all the same colour then you should be able to use a Conditional Formatting formula like this. Here I want to format 'Garden', 'Gate' and 'Shed' but not other words.
(Due to a glitch with XL2BB I have formatted cell colour instead of Font colour but Font should work on your sheet)

Book1
ABCDEF
1Shed
2GardenShed
3PathGardenHouse
4GardenHouse
5HouseGardenGardenGarden
6GardenGarden
7Garden
8ShedGate
9Shed
CF Font
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:F9Expression=SEARCH("|"&A1&"|","|Garden|Gate|Shed|")textNO
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,836
Members
449,096
Latest member
Erald

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