Bonsoir,
je cherche depuis pas mal de temps mais là je sèche.
En fonction d'une valeur, je souhaite ouvrir plusieurs onglets : par exemple chiffre 2, 2 onglets spécifiques, chiffre 5, 5 onglets spécifiques.
Voici le code que j'ai écrit :
En pièce jointe, un imprim-écran du code d'erreur.
Merci pour l'aide que vous pourrez m'apporter.
Cordialement
je cherche depuis pas mal de temps mais là je sèche.
En fonction d'une valeur, je souhaite ouvrir plusieurs onglets : par exemple chiffre 2, 2 onglets spécifiques, chiffre 5, 5 onglets spécifiques.
Voici le code que j'ai écrit :
Code:
Dim val_ref As Integer
val_ref = Range("k4")
Select Case val_ref
Case 1
Sheets("SPTT1").Visible = True
Case 2
Sheets("SPTT1", "SPTT2").Visible = True
Case 3
Sheets("SPTT1", "SPTT2", "SPTT3").Visible = True
Case 4
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4").Visible = True
Case 5
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4", "SPTT5").Visible = True
Case 6
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4", "SPTT5", "SPTT6").Visible = True
Case 7
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4", "SPTT5", "SPTT6", "SPTT7").Visible = True
Case 8
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4", "SPTT5", "SPTT6", "SPTT7", "SPTT8").Visible = True
Case 9
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4", "SPTT5", "SPTT6", "SPTT7", "SPTT8", "SPTT9").Visible = True
Case 10
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4", "SPTT5", "SPTT6", "SPTT7", "SPTT8", "SPTT9", "SPTT10").Visible = True
Case 11
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4", "SPTT5", "SPTT6", "SPTT7", "SPTT8", "SPTT9", "SPTT10", "SPTT11").Visible = True
Case 12
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4", "SPTT5", "SPTT6", "SPTT7", "SPTT8", "SPTT9", "SPTT10", "SPTT11", "SPTT12").Visible = True
Case 13
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4", "SPTT5", "SPTT6", "SPTT7", "SPTT8", "SPTT9", "SPTT10", "SPTT11", "SPTT12", "SPTT13").Visible = True
Case 14
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4", "SPTT5", "SPTT6", "SPTT7", "SPTT8", "SPTT9", "SPTT10", "SPTT11", "SPTT12", "SPTT13", "SPTT14").Visible = True
Case 15
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4", "SPTT5", "SPTT6", "SPTT7", "SPTT8", "SPTT9", "SPTT10", "SPTT11", "SPTT12", "SPTT13", "SPTT14", "SPTT15").Visible = True
Case 16
Sheets("SPTT1", "SPTT2", "SPTT3", "SPTT4", "SPTT5", "SPTT6", "SPTT7", "SPTT8", "SPTT9", "SPTT10", "SPTT11", "SPTT12", "SPTT13", "SPTT14", "SPTT15", "SPTT16").Visible = True
End Select
En pièce jointe, un imprim-écran du code d'erreur.
Merci pour l'aide que vous pourrez m'apporter.
Cordialement