Re: For Each Loop



Thanks Tushar actually this is the new code i am using which seems to
work partialy well:

[code]Sub test()

Dim ws As Work***, rng
rng = Array(13, 16, 22, 27)
For Each ws In Worksheets
x = Application.Match(ws.Name, Array("as", "AT&T Lease"), 0)
If Not IsError(x) Then
'change to "If IsError(x) Then to make it search all except what is
listed above
With ws
For i = 0 To UBound(rng)
flag = False
Select Case .Range("b" & rng(i)).Value
Case Is <= Date
.Tab.ColorIndex = 3
' Application.Run ("TabRed"): flag = True
Case Is < Date + 30
.Tab.ColorIndex = 6
'Application.Run ("TabYellow"): flag = True
Case Else
.Tab.ColorIndex = -4142
'Application.Run ("TabWhite"): flag = False
End Select
If flag Then Exit For
Next
End With
End If
Next
End Sub
[/code]

The Tab Red macro is:
ActiveWorkbook.Sheets("AT&T Lease").Tab.ColorIndex = 3

What i can't figure out now is how to change the tab red macro to not
be a specific *** but the *** the loop is checking.

What the loop does is check 4 cells in specific sheets. Those cells
have dates in them and if any of them = today i want the *** tab to
be red and so on. If one of the cells meet the criteria i have it stop
the loop and go to the next ***.

I hope that all made some kind of sence. Any ideas? or Things i
should clarify?

Thanks alot for the help i really appreciate it.

.