View Single Post
  #5 (permalink)  
Old October 25th, 2004, 04:53 AM
gcianfanelli gcianfanelli is offline
Authorized User
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts

You need to do something like

  Dim oCell As Excel.Range
  Dim oSheet As Excel.Worksheet

  Set oSheet = ActiveSheet

  For Each oCell In oSheet.Range("A:A").SpecialCells(xlCellTypeConstants)
    Select Case CStr(oCell.Value)
    Case "3", "three"
      With oCell.Interior
        .ColorIndex = 4
        .Pattern = xlSolid
      End With
    End Select

This should go through the current worksheet's cells in Column A, processing only those that have some sort of value. In my example, if it meets a numeric value of 3, or text value of "three", it will set the cell's background to green.
Reply With Quote