Copy several graphs in VBA

Ehtisham Ali

New Member
Joined
Jul 31, 2014
Messages
2
Hey fellas,
this is urgent.

I have graphs on various worksheets in same workbook. Now I want to paste all the graphs on new worksheet in same workbook. Say for example 4 WS contains 4 different graphs, now I want 1 new WS contains all 4 graphs one below another.

the paste method should be as picture.

Thanks in advanced.

Ehtisham Ali
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
This works for me:

Code:
Sub Copy_Charts()
    Dim ch As ChartObject, ws As Worksheet
    Sheets.Add.Name = "New"
    k = 2
    For Each ws In ActiveWorkbook.Worksheets
        If ws.Name = "New" Then GoTo skip
        ws.Activate
        For Each ch In ActiveSheet.ChartObjects
            ch.Activate
            ActiveChart.ChartArea.Copy
            Sheets("New").Activate
            Range("B" & k).Select
            ActiveSheet.Pictures.Paste
            k = k + 15
        Next
skip:
    Next
End Sub
You may need to play around with the value of k depending on the size of your charts.

Hope this helps,

Chris.
 
Upvote 0
This works for me:

Code:
Sub Copy_Charts()
    Dim ch As ChartObject, ws As Worksheet
    Sheets.Add.Name = "New"
    k = 2
    For Each ws In ActiveWorkbook.Worksheets
        If ws.Name = "New" Then GoTo skip
        ws.Activate
        For Each ch In ActiveSheet.ChartObjects
            ch.Activate
            ActiveChart.ChartArea.Copy
            Sheets("New").Activate
            Range("B" & k).Select
            ActiveSheet.Pictures.Paste
            k = k + 15
        Next
skip:
    Next
End Sub
You may need to play around with the value of k depending on the size of your charts.

Hope this helps,

Chris.

thanks a lot Chris it helped me a lot.
 
Upvote 0

Forum statistics

Threads
1,214,787
Messages
6,121,558
Members
449,038
Latest member
Guest1337

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