Question : Get rid of tab color on all tabs between 2 tabs

I have a bunch of tabs between Tab Name "PE" and "DTP" that I want to clear the color from before i run the following

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
Sub ColorTabs()
Dim TabName As String

x = 1

Sheets("Pending List").Activate
Do Until Cells(x, 1).Value = ""

  TabName = Cells(x, 1).Value

For Each Sheet In ActiveWorkbook.Sheets
If InStr(Sheet.Name, TabName) Then
 Sheet.Tab.ColorIndex = 3
End If
Next

  x = x + 1
  
Loop
End Sub

Answer : Get rid of tab color on all tabs between 2 tabs

'Fixed typo on ending tabname
Sub ClearColors()
Start = 0
mydefault = 16
For Each Sheet In ActiveWorkbook.Sheets
If Sheet.Name = "PE" Then
  Start = 1
  mydefault = Sheet.Tab.ColorIndex
ElseIf (Start = 1) Then

  If (Sheet.Name <> "DTP") Then

  Sheet.Tab.ColorIndex = mydefault '(not sure if this is your default tab color - you may have to change this number)
 ElseIf Sheet.Name = "DTP" Then
  Exit Sub
 End If

End If

Next
End Sub
Random Solutions  
 
programming4us programming4us