Exception maken ?

Status
Niet open voor verdere reacties.

VeerleVR

Gebruiker
Lid geworden
5 aug 2011
Berichten
38
Hoi,

Ik heb een excelbestand met 4 draaitabellen in eenzelfde tabblad.
De eerste 3 draaitabellen zijn gelinkt aan elkaar via codes zodat als je bij 1 van de 3 een filter aanpast ze allemaal automatisch mee updaten.

De 4e mag echter niet gelinkt worden aan de eerste 3 omdat deze andere gegevens bevat. Hoe kan ik dit oplossen ?

Dit is de code :
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Application.EnableEvents = False
Dim Pt As PivotTable, choice As String

For Each Pt In ActiveSheet.PivotTables
Dit is de eerste filter
If Pt.Name <> Target.Name Then
choice = Target.PivotFields("Client").CurrentPage
Pt.PivotFields("Client").CurrentPage = choice
End If
Dit is de tweede filter
If Pt.Name <> Target.Name Then
choice = Target.PivotFields("Category").CurrentPage
Pt.PivotFields("Category").CurrentPage = choice
End If
Dit is de derde filter
If Pt.Name <> Target.Name Then
choice = Target.PivotFields("Value").CurrentPage
Pt.PivotFields("Value").CurrentPage = choice
End If
Dit zijn 3 filters van de 4e draaitabel (die dus andere data bevat)
If Pt.Name <> Target.Name Then
choice = Target.PivotFields("Client GP").Draaitabel4
Pt.PivotFields("Client GP").Draaitabel1 = choice
End If
If Pt.Name <> Target.Name Then
choice = Target.PivotFields("Category GP").Draaitabel4
Pt.PivotFields("Category GP").Draaitabel1 = choice
End If
If Pt.Name <> Target.Name Then
choice = Target.PivotFields("Value GP").Draaitabel4
Pt.PivotFields("Value GP").Draaitabel1 = choice
End If

Pt.Update
Next Pt
Application.EnableEvents = True
Cells.EntireColumn.AutoFit
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan