Sub Color()
'
' Color Macro
' Macro recorded 2/4/2009 by EWatson
'
'
Dim r As Range, rng As Range
With ActiveSheet.UsedRange
'set the range of names in your table
Set rng = Range([F2], [F2].End(xlDown))
'make sure the AutoFilter is on
If Not .Parent.AutoFilterMode Then .Parent.[A1].AutoFilter
End With
For Each r In [MyList] '[b]substitute YOUR LIST NAME in the brackets[/b]
'filter each name in the list
Range("A1").AutoFilter _
Field:=6, Criteria1:=r.Value
'shade the visible cells if there are any other than the heading row
If rng.SpecialCells(xlCellTypeVisible).Rows.Count > 1 Then
With rng.SpecialCells(xlCellTypeVisible).Interior
.ColorIndex = r.Interior.ColorIndex
.Pattern = xlSolid
End With
End If
Next
'shade the headings
With Range("A1:G1").Interior
.ColorIndex = 38
.Pattern = xlSolid
End With
'show all the data in the table
ActiveSheet.ShowAllData
End Sub