Thread: Macros & vba
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Macros & vba

Here are two ways:

By Conditional Formatting

Highlight column A
From the Format menu, Conditional Formatting
Formula Is: =A1="a text string"

or by Macro

Sub test()
Dim rng As Range

With ActiveSheet
For Each rng In Range(.Cells(1, 1), .Cells(Rows.Count, 1).End(xlUp))
If rng.Value = "a text string" Then rng.Interior.Color =
RGB(255, 0, 0)
Next
End With
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"spak1971" wrote in message
...
I'm using excel 2000.
How can I search a range of cells and get only those cells to change color
if they meet certain criteria eg: "a text string"? So far I've only been
able
to get the entire range to change!!