View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Kragelund Kragelund is offline
external usenet poster
 
Posts: 34
Default Using combo box to change color of tabs (xl 2003)

Hi, I want to use a combo box to iniate a procedure to change the color of
the sheet tabs depending on which selection is made: the options a

1. grey tab if no data has been added to a particular worksheet
2. yellow if data has been added, but not validated (never mind the color
code is wrong)
3. Green if data has been added to a worksheet and validated.

My code:

Private Sub ComboBox1_Change()

worksheets(ComboBox1.Value).Select

Set CBox = ComboBox1.ListIndex

If ComboBox1.ListIndex < -1 Then

Select Case LCase(CBox)

Case 0 ' The corresponding text for this option is "data missing"
Sheets("FirstPg").Select
ActiveWorkbook.Sheets("Forside").Tab.ColorIndex = 15

Case 1 ' The corresponding text for this option is "data updated"
Sheets("FirstPg").Select
ActiveWorkbook.Sheets("Forside").Tab.ColorIndex = 97

Case 2 ' The corresponding text for this option is "data validated"
Sheets("FirstPg").Select
ActiveWorkbook.Sheets("Forside").Tab.ColorIndex = 43

Case Else

End Select
End If
End Sub

Why does this fail?

Thks in advance!