Visual Basic for Applications (VBA)


How to run a macro when a Filter is applied on Particular Pivot Field


I have seen how to call a macro when a filter is applied on the pivot table here: How
to run a macro automatically when the selections of pivot tables are changed
But I have a different requirement, I have 5 Pivot Fields and each filter change has a different function to perform. So, I'm wondering if it is possible to assign a different macro for each of the Pivot Fields?
I know that I can use worksheet_Change function and then use range as a parameter to check whether a filter is applied in that range or not. But the problem here is, I'll be moving the Pivot Fields to Column labels and Row Labels within the macro which will
call other macros subsequently.
I don't want that to happen. That is the reason I'm searching for a way to detect Pivot Filter change on ONE PIVOT FIELD
Pramod
You can use
Application.EnableEvents=false
'Do other code
Application.EnableEvents=True
If that doesn't work, then the other standard practice is to use a global variable such as IgnoreEvent:
Dim IgnoreEvent as Boolean
IgnoreEvent=True
'Do other code
IgnoreEvent=False
Then in other events, if IgnoreEvent is True, exit the event without doing anything.Rod Gill
Author of the one and only Project VBA Book
www.project-systems.co.nz
I'm sorry but I think I didn't get your answer completely. I didn't understand how I'll get to know which Pivot
Field has caused the macro to run. Because, whenever a Field item selection filter is changed, I move that to Column or Row label (Depending on my need) and then perform some actions on them. So, can you please tell me how can I know the Pivot Field that fired
the macro?
You can use
Application.EnableEvents=false
'Do other code
Application.EnableEvents=True
If that doesn't work, then the other standard practice is to use a global variable such as IgnoreEvent:
Dim IgnoreEvent as Boolean
IgnoreEvent=True
'Do other code
IgnoreEvent=False
Then in other events, if IgnoreEvent is True, exit the event without doing anything.
Rod Gill
Author of the one and only Project VBA Book
www.project-systems.co.nz
Pramod

Related Links

Tree View Active X help files missing
Macro to read GUI Application
How to fill in blank cells with correct data without overwriting the data above it?
rch for date and return other fields
How to paste clipboard content to a folder (as a file)
Copy Outlook Message body content into MS Excel
extract a CAB file with VBA
OMG my project has crashed
Assigning Range of Cells to Array
Create Code to Update Value in Record From Previous Data Record
MSComm -Having problem receiving data from modem
Exporting Microsoft Word Review Comments to Microsoft Excel - Error 91 ??
error 1004 application defined or object defined error
Change File Names Using SQL Query to get new UID
Listbox question (prevent refresh)
Listview.listitem.key Intermitent Failure

Categories

MSDN
Visual Studio Development
Windows and Windows ph...
Windows Desktop Develo...
Apps for Office and Sh...
Visual Studio Team Fou...
Data Platform Development
SQL Server
Windows Forms
WebsitePanel
Samsung PC
Project Server
Microsoft Atlas API: D...
Archived Forums #
Archived Forums A-B
Archived Forums E-H
Archived Forums SN-SZ
Open source Developmen...
Visual Studio Editor
Visual Studio Tools fo...
Register and Manage Ac...
Windows App Studio Beta
Dev Center App
Promote Your App
XboxLiveDevelopment
Microsoft Message Queu...
Excel for Developers
Developing Apps for Sh...
SharePoint 2010 - Setu...
SharePoint Legacy Vers...
Azure Media Services
Azure HDInsight
Azure Scripting and Co...
Azure Notification Hubs
Machine Learning
StorSimple
Azure SQL Data Warehouse
Azure Data Lake Analyt...
Azure Log Integration
Azure Time Series Insi...
Team Foundation Server...
BizTalk Server General
BizTalk Server RFID
ADO.NET Entity Framewo...
Internet Explorer Exte...
Microsoft Robotics - S...
SQL Server Tools
SQL Server High Availa...
SQL Server Notificatio...
SQL Server Spatial
SQL Server Migration
SQL Server Distributed...
Windows Embedded 8 Sta...
Standard 2009: Embedde...
SQL Server 2012 PowerP...
SQL Server 2012 Report...
Windows Live Messenger...
Bing Maps: Map Control...
Script Junkie Discussion
Bing Maps REST, SOAP, ...
Bing Maps for Windows ...
Bing Ads API: Development
Silverlight Controls a...
Visual Studio & Silver...
Game Development with ...
Expression Studio
Retired SharePoint Col...
Architecture Events
Axum Incubation Project
Azure Startups
Building Windows Store...
AppFabric Caching
Casablanca
Core Coding Experience...
DNS and Traffic Manager
Chart Controls for .NE...
Feedback for Visual Ba...
General Windows MultiP...
Git, Mercurial and Dro...
LightSwitch in Visual ...
LINQ Project General
Microsoft adCenter: De...
Multimap API Developme...
Monitor, Alert and Aut...
Parallel Computing Pla...
Regular Expressions
Parallel Programming w...
Search, Organize, and ...
Storage Platform – ATA
Surface Application De...
SyncFx - Feedback [Rea...
SQL Server 2014 Analys...
SQL Server 2014 In-Mem...
SQL Server 2014 Integr...
Team Foundation Server...
Team Foundation Server...
Team Foundation Server...
Tailoring your Windows...
Visual Basic Express E...
Visual Basic IDE
Visual C# IDE
Visual Studio Database...
Visual Studio Gallery ...
Visual Studio Team Sys...
Visual Studio Online "...
WCF Data Services (Pre...
Windows Developer Prev...
Windows SideShow Devel...
OneDrive Development (...
Microsoft Graph
Cortana Skills Kit

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile