colene
04-10-2008, 10:53 PM
Project
sub project Jan 01 Jan 02 Jan 03
TP1 222 221 234
TP2 22 120 322
TP3 456 89 567
TP4 234 222 221
These values are on Sheet Data .I want to have a chart with this data .Here the year and the subprojects can vary in size for diffrent projects .
I have done the following code in Worksheet activate and my graph with dynamic ranges gets reflected only on the click of this sheet ..But I want it to happen on Chart_activate
Private Sub Worksheet_Activate()
Dim chtChart As Chart
Range("A3").Select
Selection.CurrentRegion.Select
myrange = Selection.Address
Set chtChart = Charts(1)
chtChart.ChartTitle.Text = "Chart with Dynamic ranges"
chtChart.SetSourceData (Sheets("Data").Range(myrange))
End Sub
Any suggestion please..Thanks in advance
sub project Jan 01 Jan 02 Jan 03
TP1 222 221 234
TP2 22 120 322
TP3 456 89 567
TP4 234 222 221
These values are on Sheet Data .I want to have a chart with this data .Here the year and the subprojects can vary in size for diffrent projects .
I have done the following code in Worksheet activate and my graph with dynamic ranges gets reflected only on the click of this sheet ..But I want it to happen on Chart_activate
Private Sub Worksheet_Activate()
Dim chtChart As Chart
Range("A3").Select
Selection.CurrentRegion.Select
myrange = Selection.Address
Set chtChart = Charts(1)
chtChart.ChartTitle.Text = "Chart with Dynamic ranges"
chtChart.SetSourceData (Sheets("Data").Range(myrange))
End Sub
Any suggestion please..Thanks in advance