VBA for Chart is failing in Excel 2007

raj08536

Active Member
Joined
Aug 16, 2007
Messages
322
Office Version
  1. 365
Platform
  1. Windows
Following is working in Excel 2003 but not in 2007

ActiveSheet.ChartObjects("Chart 5").Activate
ActiveChart.PlotArea.Select
ActiveChart.SetSourceData Source:=Sheets("NewChart").Range _
("C65:Ax65,C71:Ax71"), PlotBy:=xlRows


Anybody please help me......
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Maybe

Code:
ActiveSheet.ChartObjects("Chart 5").Chart.SetSourceData Source:=Sheets("NewChart").Range("C65:Ax65,C71:Ax71"), PlotBy:=xlRows
 
Upvote 0
VoG - you rocks......

Now the following code is crashing - specially at " ActiveChart.SeriesCollection(2).Select"

ActiveSheet.ChartObjects("Chart 5").Activate
ActiveChart.SeriesCollection.Paste Rowcol:=xlRows, SeriesLabels:=True, _
CategoryLabels:=False, Replace:=False, NewSeries:=True
Application.CutCopyMode = False

ActiveChart.SeriesCollection(2).Select
ActiveChart.SeriesCollection(2).ChartType = xlColumnClustered
ActiveChart.SeriesCollection(2).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
ActiveWindow.Visible = False
 
Upvote 0
Maybe like this

Code:
With ActiveChart.SeriesCollection(2)
    .ChartType = xlColumnClustered
    With .Border
        .Weight = xlThin
        .LineStyle = xlAutomatic
    End With
    .Shadow = False
    .InvertIfNegative = False
    With .Interior
        .ColorIndex = 3
        .Pattern = xlSolid
    End With
End With
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,733
Members
452,939
Latest member
WCrawford

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