Bnsoir, je viens avec un mystère.
Après avoir fouillé le net j'ai trouvé ce code pour verrouiller des cellules et malgré tout pouvoir utiliser un plan sans déverrouiller (Cellules créer plan grouper)
Voici ledit code (qui fonctionne je l'ai testé)
Bon, il marche très bien tout seul, lorsque je l'ai testé.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 Sub testmpgroupe() Application.ScreenUpdating = False ActiveSheet.Outline.ShowLevels rowlevels:=2 ActiveSheet.EnableOutlining = True 'permet de garder la fonctionnalité PLANS ActiveSheet.Protect "vince", UserInterfaceOnly:=True, DrawingObjects:=False, Contents:=True, Scenarios:= _ False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _ AllowDeletingRows:=True, AllowFormattingRows:=True, AllowInsertingRows:=True, AllowSorting:=True, _ AllowFiltering:=True, AllowUsingPivotTables:=True Application.ScreenUpdating = True End Sub
Maintenant je l'ai intégré à ma macro qui fait plein de chose à la fermeture, entre autre il groupe certaines cellules. Ceci dans le "ThisWorkbooks"before close.
Ben croyez le ou non, dans ce cas là le code ne fonctionne plus et je ne peux pas utiliser mon plan dans les pages sans déverrouiller les cellules.
C'est incompréhensible (pour moi), j'ai passé le code en revue plusieurs fois, testé, rien de rien ça ne marche pas. POurquoi ? YY a t il un conflit ? Quelqu'un à une idée ?
Voici le code , accrochez - vous bien :
Bonne nuit
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim NB As Long Dim NomFeuille As String Dim MP As String Dim I As Long Dim Lig As Long Dim Actif Application.ScreenUpdating = False NomFeuille = ActiveSheet.Name MP = "fabienne" For NB = 5 To Worksheets.Count Worksheets(NB).Activate ActiveSheet.Unprotect MP ActiveSheet.Outline.ShowLevels rowlevels:=2 Lig = 4 For I = 4 To 9 On Error GoTo Pascache: If Cells(Lig, 4) = "Convoqué" Then Rows(Lig + 15).ShowDetail = False End If Pascache: Lig = Lig + 16 Next I Range("A1").Select ActiveSheet.EnableOutlining = True 'permet de garder la fonctionnalité PLANS ActiveSheet.Protect "fabienne", UserInterfaceOnly:=True, DrawingObjects:=False, Contents:=True, Scenarios:= _ False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _ AllowDeletingRows:=True, AllowFormattingRows:=True, AllowInsertingRows:=True, AllowSorting:=True, _ AllowFiltering:=True, AllowUsingPivotTables:=True Next NB Sheets(NomFeuille).Activate Application.ScreenUpdating = True End Sub
Partager