Bonjour,
Je creer ce poste aujourd'hui car j'ai pas reussis a adapter les solutions que j'ai trouve pour mon code VBA
mon code consiste a bloquer le pivot table field par une macro et je voudrais que quand je l'actionne cela marche pour toute mes pages qui comporte 4 PT/page
code:
je sais qu'il faut utiliser une variable i et faire une boucle mais j'arrive pas a adapter pour mon code ....
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 Option Explicit 'Option Private Module Public Sub Not_Restrictions() 'Ctrl + Shift + X Dim response Do response = Application.InputBox("Mot de passe :", Type:=2, Title:="Oter la Protection") Loop While response <> PWD And response = "" If response = False Then Exit Sub With Worksheets("User 1") .Unprotect Password:=PWD For Each pt In .PivotTables pt.EnableFieldList = True Next End With 'ActiveWorkbook.ShowPivotTableFieldList = True End Sub Public Sub Restrictions() 'Ctrl + Shift + W With Worksheets("User 1") For Each pt In .PivotTables pt.EnableFieldList = False Next .Protect Password:=PWD, _ userinterfaceonly:=True, _ AllowUsingPivotTables:=True End With 'ActiveWorkbook.ShowPivotTableFieldList = False End Sub
(mes 6 pages sont nomees User 1 / User 2 / User 3 ....)
Merci de votre aide en avance !
PS: desole pour les accent j'ai un clavier anglais![]()
Partager