Sub Selection()
ActiveSheet.Shapes("Groupe_Num_Dept").Left = 75
ActiveSheet.Shapes("Groupe_Num_Dept").Top = 90
Dim n As Integer, Pref As String, Teste As String
[AD23] = Mid(Application.Caller, InStr(Application.Caller, "-") + 1)
' ôter toutes les couleurs
For n = 1 To ActiveSheet.Shapes.Count - 3
ActiveSheet.Shapes(n).Fill.ForeColor.SchemeColor = 9
Next n
' ci-dessous on colorie tous les dépt concernés en bleu
Select Case [AD23]
Case 22, 29, 35, 56 '(Bretagne)
ActiveSheet.Shapes("FR-22").Fill.ForeColor.SchemeColor = 4
ActiveSheet.Shapes("FR-29").Fill.ForeColor.SchemeColor = 4
ActiveSheet.Shapes("FR-35").Fill.ForeColor.SchemeColor = 4
ActiveSheet.Shapes("FR-56").Fill.ForeColor.SchemeColor = 4
End Select
On Error Resume Next
' et on colorie le dépt cliqué en vert
choix = Format(CStr([AD23]), "00")
ActiveSheet.Shapes("FR-" & choix).Fill.ForeColor.SchemeColor = 3
If ActiveSheet.CheckBox1.Value = True Then
Pref = LTrim(Replace(ActiveSheet.Shapes("FR-" & choix).TextFrame2.TextRange.Characters.Text, vbLf, ""))
Pref = LTrim(Mid(Pref, 3))
Sheets(Pref).Activate
End If
End Sub
Option Explicit
Sub test()
Dim i As Integer
For i = 2 To Sheets.Count
Sheets(i).Visible = xlSheetHidden
Next i
End Sub
Merci de ton code mais le problème est que je n'est plus de lien qui fonctionne?
With Sheets("NomFeuille")
.Visible = xlSheetVisible
.Activate
End With
If ActiveSheet.CheckBox1.Value = True Then
Pref = LTrim(Replace(ActiveSheet.Shapes("FR-" & choix).TextFrame2.TextRange.Characters.Text, vbLf, ""))
Pref = LTrim(Mid(Pref, 3))
'ici tu rends visible la feuille.....
Sheets(Pref).Activate
End If
If ActiveSheet.CheckBox1.Value = True Then
Pref = LTrim(Replace(ActiveSheet.Shapes("FR-" & choix).TextFrame2.TextRange.Characters.Text, vbLf, ""))
Pref = LTrim(Mid(Pref, 3))
'ici tu rends visible la feuille.....
With Sheets("Vannes")
.Visible = xlSheetVisible
.Activate
End With
Sheets(Pref).Activate
End If
If ActiveSheet.CheckBox1.Value = True Then
Pref = LTrim(Replace(ActiveSheet.Shapes("FR-" & choix).TextFrame2.TextRange.Characters.Text, vbLf, ""))
Pref = LTrim(Mid(Pref, 3))
'ici tu rends visible la feuille.....
With Sheets(Pref)
.Visible = xlSheetVisible
.Activate
End With
End If
Private Sub CommandButton1_Click()
If CommandButton1.Caption = "Masquer les feuilles" Then
CommandButton1.Caption = "Afficher les feuilles"
' ici opérations à exécuter
Else
CommandButton1.Caption = "Masquer les feuilles"
' ici opérations à exécuter
End If
masquer_démasquer
End Sub
Sub masquer_démasquer()
Dim oSh As Worksheet
Application.ScreenUpdating = False
For Each oSh In ThisWorkbook.Sheets
If oSh.Name <> "France" And oSh.Name <> "Fr_Régions" Then oSh.Visible = Not oSh.Visible
Next oSh
Application.ScreenUpdating = True
End Sub
If ActiveSheet.CheckBox1.Value = True Then
Pref = LTrim(Replace(ActiveSheet.Shapes("FR-" & choix).TextFrame2.TextRange.Characters.Text, vbLf, ""))
Pref = LTrim(Mid(Pref, 3))
'ici tu rends visible la feuille.....
With Sheets(Pref)
.Visible = xlSheetVisible
.Activate
End With
Sheets(Pref).Activate
Mon problème si je veut masquer les feuilles que j'ai ouverte a l'aide de mon code je ne peut plus?
If oSh.Name <> "Accueil" And oSh.Name <> "recap" Then oSh.Visible = Not oSh.Visible