Yepee... onglets de feuille variables mais fixes ?
salut tous et merci
CA MARCHE
petite explication:
le classeur s'ouvre sur la feuille("Y") qui donne le choix de langue et modifie la celulle "A1" de la feuille("Trad") ce qui a pour effet :
<i>Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Set Wt = Worksheets("Trad")
Set Ws = Worksheets
If Target.Address = "$A$1" Then
Ws("BD").ValidButton1.Caption = Wt.Range("A2")
Ws("17-6").OptionButton2.Caption = Wt.Range("A72")
Ws("17-6").Label1.Caption = Wt.Range("A71")
Ws("17-12r").Label1.Caption = Wt.Range("A134")
Ws("17-12v").Label1.Caption = Wt.Range("A135")
Ws("17-13s").Label1.Caption = Wt.Range("A136")
Ws("17-13l").Label1.Caption = Wt.Range("A136")
Ws("17-13s").CommandButton1.Caption = Wt.Range("A137")
Ws("17-13s").CommandButton2.Caption = Wt.Range("A137")
Ws("17-13l").CommandButton1.Caption = Wt.Range("A137")
Ws("17-13l").CommandButton2.Caption = Wt.Range("A137")
Ws("16-18").Label1.Caption = Wt.Range("A138")
Ws("01").CommandButton1.Caption = Wt.Range("A152")
Ws("BD").Label1.Caption = Wt.Range("A4")
Ws("17-5II").CommandButton1.Caption = Wt.Range("A166")
Ws("17-26Vv").Label1.Caption = Wt.Range("A175")
Ws("17-26Vv").CommandButton1.Caption = Wt.Range("A176")
Ws("17-26V").Name = Wt.Range("A119").Value
Ws("17-5IIId").Name = Wt.Range("A111").Value
Ws("17-5IIIp").Name = Wt.Range("A112").Value
Ws("17-5II").Name = Wt.Range("A106").Value
Ws("17-5I").Name = Wt.Range("A113").Value
Ws("17-9").Name = Wt.Range("A114").Value
Ws("17-5IIv").Name = Wt.Range("A129").Value
Ws("17-33").Name = Wt.Range("A115").Value
Ws("16-18").Name = Wt.Range("A116").Value
Ws("17-52").Name = Wt.Range("A125").Value
Ws("17-14").Name = Wt.Range("A126").Value
Ws("02").Name = Wt.Range("A122").Value
Ws("021").Name = Wt.Range("A123").Value
Ws("15-5IIIv").Name = Wt.Range("A130").Value
Ws("17-31").Name = Wt.Range("A124").Value
Ws("17-5Iv").Name = Wt.Range("A128").Value
Ws("17-6").Name = Wt.Range("A103").Value
Ws("17-26Vv").Name = Wt.Range("A120").Value
Ws("01").Name = Wt.Range("A118").Value
Ws("17-12r").Name = Wt.Range("A104").Value
Ws("17-12v").Name = Wt.Range("A105").Value
Ws("17-13s").Name = Wt.Range("A107").Value
Ws("17-13l").Name = Wt.Range("A108").Value
Ws("17-5_IV").Name = Wt.Range("A109").Value
Ws("17-5IIIr").Name = Wt.Range("A110").Value
End If
End Sub</i>
ensuite l'utilisateur se retrouve avec la feuille("BD"), et il doit cliquer sur le bouton pour en sortir, ce qui donne:
<i>Private Sub ValidButton1_Click()
Dim Ws As Worksheet
Dim F1 As String 'odt
Dim F2 As String 'A_cm
Dim F3 As String 'D_cm
Dim F4 As String 'VenV
Dim F5 As String 'Crédit
Dim F6 As String 'Stat_V
Dim F7 As String 'Bon
Dim F8 As String 'Subs
Dim F9 As String 'VIVA
Dim F10 As String 'VivI
Dim F11 As String 'Gré
Dim F12 As String 'OdtI
F1 = Worksheets("Trad").Range("A119").Value
F2 = Worksheets("Trad").Range("A125").Value
F3 = Worksheets("Trad").Range("A126").Value
F4 = Worksheets("Trad").Range("A130").Value
F5 = Worksheets("Trad").Range("A128").Value
F6 = Worksheets("Trad").Range("A129").Value
F7 = Worksheets("Trad").Range("A124").Value
F8 = Worksheets("Trad").Range("A114").Value
F9 = Worksheets("Trad").Range("A115").Value
F10 = Worksheets("Trad").Range("A116").Value
F11 = Worksheets("Trad").Range("A118").Value
F12 = Worksheets("Trad").Range("A120").Value
Application.ScreenUpdating = False
Worksheets("BD").Visible = False
For Each Ws In Sheets(Array("X", "Y", "z", "tableau", "tablo", "Trad"))
Ws.Visible = xlSheetVeryHidden
Next
If CheckBox2.Value = True Then
For Each Ws In Sheets(Array(F2, F3)) '"A_cm", "D_cm"))
Ws.Visible = xlSheetVisible
Next
Else
For Each Ws In Sheets(Array(F2, F3)) '"A_cm", "D_cm"))
Ws.Visible = xlSheetHidden
Next
End If
If CheckBox3.Value = True Then
For Each Ws In Sheets(Array(F4, F5, F6)) '"VenV", "Crédit", "Stat_v"))
Ws.Visible = xlSheetVisible
Next
Else
For Each Ws In Sheets(Array(F4, F5, F6)) '"VenV", "Crédit", "Stat_v"))
Ws.Visible = xlSheetHidden
Next
End If
If CheckBox4.Value = True Then
Worksheets(F7).Visible = True '"Bon").Visible = True
Else: Worksheets(F7).Visible = False '"Bon").Visible = False
End If
If CheckBox5.Value = True Then
For Each Ws In Sheets(Array(F8, F9, F10, F11, F1, F12)) '"Subs", "VIVA", "VivI", "Gré", "Odt", "OdtI"))
Ws.Visible = xlSheetVisible
Next
Else
For Each Ws In Sheets(Array(F8, F9, F10, F11, F1, F12)) '"Subs", "VIVA", "VivI", "Gré", "Odt", "OdtI"))
Ws.Visible = xlSheetHidden
Next
End If
ActiveWindow.DisplayWorkbookTabs = True
With ActiveWindow
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
End With
Application.ScreenUpdating = True
End Sub</i>
et ca marche... mais je pense qu'il est possible de simplifier...
si quelqu'un a une idée ;-)
ya'v