Article ID: 193244
Article Last Modified on 6/17/2005
Sub Check_Values_1()
Dim CurCell As Object
For Each CurCell In Selection
If CurCell.Value = 5 Then CurCell.Interior.ColorIndex = 6
Next
End Sub
The following example loops through a specified range instead of the
selected range and sets any cells that equal 10 to 20.
Sub Check_Values_2()
Dim CurCell As Object
For Each CurCell In Range("A1:A10")
If CurCell.Value = 10 Then CurCell.Value = 20
Next
End Sub
For additional information on looping, please see the following
article in the Microsoft Knowledge Base:
141762 XL: How to Use Looping Structures in Visual Basic for Applications
Additional query words: XL98
Keywords: kbhowto kbdtacode KB193244