Trick of the Week:: How to Create Interactive Charts in Excel – Chart Events

Posted: April 15, 2014 by MaxFraudy in Excel, VBA
Tags: , ,

In my experience I have come across numerous people who so wish that their charts are ‘Interactive’. I’m sure many of you would like to select a data point on your chart and let it act as a selection for sort of a drill-down. Doing this, although not impossible in Excel, requires sound understanding of Class Modules and chart events. I have tried to create a small example to illustrate this.

Problem Statement:I have  data for daily site views for USA, Canada and the rest of North America. While there is a top chart that shows the cumulative counts, I would like to select a data point on the chart and see a detailed view for it as below.

Chart Event Example

Chart Event Example

Solution: I created a class module called ‘clschtevents’ in which I have defined events for my chart. Once I declare it, I can see other events associated with the chart in the dropdown on the right. I can now write code with any of these events.

Chart Events - Event List

Chart Events – Event List

In order to use this class module, I need to create an object with this class type as below. Once this is done, all the code that was written in the class module is accessible. To see actual working of chart events, download the file and see it yourself. (Please download the file from the link)

Advertisements

Share your thoughts/feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s