Macros & vba

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!!
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top