View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] peelos@gmail.com is offline
external usenet poster
 
Posts: 1
Default Repetitive IF statement

Excuse my extremely novice post, I've been looking through google
groups to find the answer to my problem but haven't got very far..

I want to simplify the below IF statement:

Private Sub CommandButton11_Click()

' Selection of component type
If OptionButton1 = True Then
Sheets("GIT XP CLIENT STATS").Visible = True
Sheets("GROUP IT SUPPORTED XP CLIENT").Visible = True
Else
If OptionButton2 = True Then
Sheets("GIT SILO STATS").Visible = True
Sheets("GROUP IT SUPPORTED SILO SERVER").Visible = True
Else
If OptionButton3 = True Then
Sheets("GIT FARM STATS").Visible = True
Sheets("GROUP IT SUPPORTED SERVER FARM").Visible = True
Else
If OptionButton4 = True Then
Sheets("NGIT XP CLIENT STATS").Visible = True
Sheets("NON-GIT SUPPORTED XP CLIENT").Visible = True
Else
If OptionButton5 = True Then
Sheets("NGIT SILO STATS").Visible = True
Sheets("NON-GIT SUPPORTED SILO SERVER").Visible = True
Else
If OptionButton6 = True Then
Sheets("NGIT FARM STATS").Visible = True
Sheets("NON-GIT SUPPORTED SERVER FARM").Visible = True
Else
If OptionButton7 = True Then
Sheets("SW XP CLIENT STATS").Visible = True
Sheets("SHRINK WRAPPED XP CLIENT").Visible = True
Else
If OptionButton8 = True Then
Sheets("SW SILO STATS").Visible = True
Sheets("SHRINK WRAPPED SILO SERVER").Visible = True
Else
If OptionButton9 = True Then
Sheets("SW FARM STATS").Visible = True
Sheets("SHRINK WRAPPED SERVER FARM").Visible = True
Else
If OptionButton10 = True Then
Sheets("BUNDLE STATS").Visible = True
Sheets("BUNDLE").Visible = True
Else
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
Sheets("START").Visible = False
ActiveSheet.Range("A1").Select
ActiveCell = "Component Name: " & TextBox1.Text
End Sub

This above Sub works but is very long winded. This also only populates
the active sheet with the text entered into the textbox in cell A1 - I
want to populate a cell on each sheet.

I am unsure how to do this as the sheet name changes depending on the
selected option button.

Any help is much appreciated..