VBA to deselect a chart when chart is the only thing on worksheet

reece1984

New Member
Joined
May 15, 2012
Messages
18
Hi All,

Can somebody please help me. I have a worksheet with around 20 small charts which is used as a dashboard for my project. What I would like to do is use this in presentations and have the functionality where if I select a chart, a macro takes me to another tab that contains only that chart. When I want to return to the main dashboard, I would like to be able to select the chart on the new tab and a macro returns me to the main tab.

I have most of this complete but the part that is holding me back is that sometimes when the macro takes me from the main dashboard to the tab containing the chart, the chart is already selected, meaning that it cant be reselected without either clicking away or pressing escape.

So I would like either an if formula at the end of the macro taking me from the dashboard to the full page chart that checks whether the chart is selected and if it is then deselects somehow.

Or perhaps there is another way, for example I have used code like this in the past to deselect a chart


< ActiveSheet.ChartObjects("Chart1").TopLeftCell.Select >

but in this instance there are no cells around the chart to deselect to.


Also i have tried code such as

<ActiveSheet.ChartObjects("Chart1").Deselect>

but I havent had the desired results with the Deselect method for some reason.


Thank you in advance.

J
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,215,364
Messages
6,124,510
Members
449,166
Latest member
hokjock

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
Back
Top