J
jeremiah
My code below works as long as it finds that tab color, but in the event
there are no tabs with this colorindex it crashes Excel completely. My tabs
colors are assigned earlier in the process by criteria. It is looking for
seasonal employees, which we will not have until March so when this part of
the code runs it crashes. Is there an easy workaround?
Sub Select1seasonal()
Dim s() As String
Dim ws As Worksheet
Dim i As Integer
i = 0
For Each ws In Worksheets
If ws.Tab.ColorIndex = 37 Then
ReDim Preserve s(i)
s(i) = ws.Name
i = i + 1
End If
Next ws
Worksheets(s).Select
there are no tabs with this colorindex it crashes Excel completely. My tabs
colors are assigned earlier in the process by criteria. It is looking for
seasonal employees, which we will not have until March so when this part of
the code runs it crashes. Is there an easy workaround?
Sub Select1seasonal()
Dim s() As String
Dim ws As Worksheet
Dim i As Integer
i = 0
For Each ws In Worksheets
If ws.Tab.ColorIndex = 37 Then
ReDim Preserve s(i)
s(i) = ws.Name
i = i + 1
End If
Next ws
Worksheets(s).Select