positon template chart VBA

ziad alsayed

Well-known Member
Joined
Jul 17, 2010
Messages
665
dear all

the below code is giving error when it reach the level of posistion the chart.

Code:
Sub AddChart()
For Each ws In ActiveWorkbook.Worksheets
    ws.Select
    Range("A1:M6").Select
    ActiveSheet.Shapes.AddChart.Select
    ActiveChart.ApplyChartTemplate ("C:\Users\Ziad Alsayed\AppData\Roaming\Microsoft\Templates\Charts\Columns By Month.crtx")
        ws.Shapes.AddChart(xlColumnClustered, _
        Left:=ws.Range("A8").Left, _
        Top:=ws.ranege("A8").Top, _
        Width:=ws.Range("A8:N8").Width, _
        Height:=ws.Range("A8:N20").Height).Select
        
    ActiveChart.SetSourceData Source:=ws.Range("$A$1:$M$6")
    ActiveChart.Axes(xlValue).Select
    ActiveChart.Axes(xlValue).MinimumScale = 0

    Range("A1:A6,N1:N6").Select
    Range("N1").Activate
    ActiveSheet.Shapes.AddChart.Select
    ActiveChart.ApplyChartTemplate ("C:\Users\Ziad Alsayed\AppData\Roaming\Microsoft\Templates\Charts\Columns By Year.crtx")
    ActiveChart.SetSourceData Source:=ws.Range("$A$1:$A$6,$N$1:$N$6")
    ActiveChart.Axes(xlValue).Select
    ActiveChart.Axes(xlValue).MinimumScale = 0
Next ws
End Sub

Appreciate any asssitance.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

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