VBA Pivot Table Change Sync

ManUBlueJay

Active Member
Joined
Aug 30, 2012
Messages
250
Office Version
  1. 2016
Platform
  1. Windows
I am stumped with this code I am trying to run. It loops back 3 times without any pivot table change. The SetupMDL does not involve a pivot table. Range ("Date") fires up a calendar but not associated with a pivot table.
I removed the date and the SetupMDL to see if one of these cause the loop but it still circles back 3 times. Which means I have to enter the Date 3 times before it sticks. The code works fine if the first and second ifsis tru

VBA Code:
Private Sub Worksheet_PivotTableChangeSync(ByVal Target As PivotTable)
Application.EnableEvents = False
Worksheets("Hof List").Unprotect
Worksheets("Distribution").Unprotect

If Range("MDL_MTSelection").Value = "Type1" Then
SetUpMDL
ShowNewForm
Else
If Range("MDL_MTSelection").Value = "(All)" Then
SetUpMDL
Else
If Range("MDL_MTSelection").Value <> "(All)" Then
SetUpMDL
Application.EnableEvents = True
Range("Date").Select
Exit Sub
End If
End If
End If[
End Sub/CODE]
 

Some videos you may like

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Watch MrExcel Video

Forum statistics

Threads
1,123,142
Messages
5,599,971
Members
414,353
Latest member
ljhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top