Bonjour ordonc
Dans ThisWorkbook j'ai ça et c'est là que ça bloque
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Cancel = True
If Target.Address = "$A$2" Then
Rows(3).Hidden = Not Rows(3).Hidden
ElseIf Target.Address = "$F$2" Then
If Not Intersect(Target, Union(Range("A2"), Range("F2"))) Is Nothing Then
For Each Sh In Sheets
If Sh.Visible <> xlSheetVisible Then Afficher: Exit Sub
Next
MasquerSauf "Année " & Year(Date) 'Adapter Nom Onglet
End If
Range("A1").Select
End If
End Sub
Dans un module => AfficherOnglets j'ai macro ci-dessous
Sub Afficher()
Dim Sh As Object
Application.ScreenUpdating = False
For Each Sh In Sheets
Sh.Visible = xlSheetVisible
Next
Application.ScreenUpdating = True
End Sub
Sub MasquerSauf(nom$)
Dim Sh As Object
Application.ScreenUpdating = False
On Error Resume Next
If IsError(Sheets(nom)) Then MsgBox "Créez la feuille '" & nom & "' !", 48: Afficher: Exit Sub
For Each Sh In Sheets
If Sh.Name <> nom Then Sh.Visible = xlSheetHidden
Next
Application.ScreenUpdating = True
End Sub
Il y a incompatibilité entre ce que vous faites et ce que j'ai.
Au 1er double clic (F2) ça affiche bien tous les Onglets => normal
Ce que je voudrais si c'est possible (mais sans fichier compliqué)
Qu'au 2ème double clic ça affiche les Onglets de 2016 à 20121
Merci à tous
PS: Je m'excuse pour le fichier