| | Post: 3 | Registrato il: 20/03/2019
| Città: CASTELLO D'AGOGNA | Età: 57 | Utente Junior | 2016 | | OFFLINE | |
|
13/06/2019 12:54 | |
buongiorno a tutti
nel caso avessi la necessità di filtrare 2 o più valori per lo stesso campo come posso modificare la macro?
x = "carlo"
y = "enrico"
Sheets("PIVOT").Select
ActiveSheet.PivotTables("Tabella pivot1").PivotFields("Delivery").CurrentPage _
= "(All)"
ActiveSheet.PivotTables("Tabella pivot1").PivotFields("Delivery").ClearAllFilters
Set miocampo = ActiveSheet.PivotTables("Tabella pivot1").PivotFields("Delivery")
miocampo.CurrentPage = x
miocampo.CurrentPage = y
così facendo rimane attivo solo il secondo filtro y
grazie
alberto
|
|
| | Post: 2.255 | Registrato il: 06/04/2013
| Utente Veteran | 2010 | | OFFLINE |
|
13/06/2019 16:12 | |
ciao
qualcosa tipo:
Sub Macro1()
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Dim vItem As Variant
Dim Nomi As Variant
Set pt = ActiveSheet.PivotTables("Tabella pivot1")
Set pf = pt.PivotFields("Delivery")
pf.EnableMultiplePageItems = True
Nomi = Array("carlo", "enrico")
pt.ManualUpdate = True
With pf
.PivotItems(1).Visible = True
For i = 2 To .PivotItems.Count
If .PivotItems(i).Visible Then .PivotItems(i).Visible = False
Next i
On Error Resume Next
For Each vItem In Nomi
.PivotItems(vItem).Visible = True
Next vItem
On Error GoTo 0
End With
pt.ManualUpdate = False
End Sub
Saluti
Domenico
Win 10 - Excel 2016 |
| | Post: 3 | Registrato il: 20/03/2019
| Città: CASTELLO D'AGOGNA | Età: 57 | Utente Junior | 2016 | | OFFLINE | |
|
14/06/2019 14:49 | |
|
|
|