Copy Chart and Insert in new Sheet as picture over the same location

  • Thread starter Thread starter TFriis
  • Start date Start date
T

TFriis

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 :)
 
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(Before:=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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top