Run macro upon selection of a chart sheet

mcbien

New Member
Joined
Sep 17, 2014
Messages
5
Hello. I am trying to run a macro upon the selection of a chart sheet. I can successfully run a macro upon selection of a worksheet by putting the following code on the worksheet module:

Private Sub Worksheet_Activate()
MsgBox "WARNING: To paste your data, please use the PASTE MY DATA BUTTON on row 9. DO NOT use any other method of pasting your data. Please press Ok."
End Sub

However, when I try to do the same with a Chart Sheet (sheet with embedded pivot chart), the code does not work. I believe this is because a sheet with an embedded chart.

I tried to put the following code in the Sheet code of the chart worksheet:

Private Sub Sheet_Activate()
ActiveChart.DeSelect
End Sub

I need to be able to deselect the active chart when the chart sheet is selected.

Any idea? Thanks in advance!!

mcbien
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Private Sub Chart_Activate()
'your code here
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,108,818
Messages
5,525,077
Members
409,618
Latest member
gkllc

This Week's Hot Topics

Top