ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Chart and Insert in new Sheet as picture over the same location (https://www.excelbanter.com/excel-programming/404747-copy-chart-insert-new-sheet-picture-over-same-location.html)

TFriis

Copy Chart and Insert in new Sheet as picture over the same location
 
As topic says: I would like som VBA code, that runs through all charts
in activesheet and copy pastes them to a new sheet as pictures and
placed above the same cells...

Can any of you out there help me :)

Jon Peltier

Copy Chart and Insert in new Sheet as picture over the same location
 
Sub ChartsToPictures()
Dim chob As ChartObject
Dim pict As Shape
Dim shSource As Worksheet
Dim shTarget As Worksheet

Set shSource = ActiveSheet
Set shTarget = ActiveWorkbook.Worksheets.Add(Befo=shSource)

For Each chob In shSource.ChartObjects
chob.Chart.CopyPicture xlScreen, xlPicture, xlScreen
shTarget.Paste
Set pict = shTarget.Shapes(shTarget.Shapes.Count)
pict.Left = chob.Left
pict.Top = chob.Top
Next
End Sub


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"TFriis" wrote in message
...
As topic says: I would like som VBA code, that runs through all charts
in activesheet and copy pastes them to a new sheet as pictures and
placed above the same cells...

Can any of you out there help me :)





All times are GMT +1. The time now is 06:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com