View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default copy chart from one sheet to other.

One way -

Sub test()
Dim chobj As ChartObject

Worksheets("Sheet1").ChartObjects(2).Copy

With Worksheets("Sheet2")
.Paste
Application.CutCopyMode = False
Set chobj = .ChartObjects(.ChartObjects.Count)
With .Range("B5")
chobj.Left = .Left
chobj.Top = .Top
End With

End With
End Sub

This may leave the chartobject on Sheet2 selected. Would need to activate
Sheet2 before deselecting it.

Regards,
Peter T

"musa.biralo" wrote in message
ups.com...
Hi,
i have one chart on each sheet. i record a macro to copy chart from one
sheet to other. when i run the macro...it's taking a while to
copy....will you please help me to make it faster. my other problem is
to paste the chart at specific x,y or at say B5. how can i do that...

(i tried using sendkeys "^C" but its not working...for some reason...)

Worksheets("a").ChartObjects(1).Copy

Sheets("b").Select
ActiveSheet.Paste

'--------------------------------------------------

ActiveSheet.ChartObjects(1).Activate
namechart = ActiveSheet.ChartObjects(1).Name
ActiveSheet.Shapes(namechart).IncrementLeft 265.5
ActiveSheet.Shapes(namechart).IncrementTop -116.25

recording macro gave me these lines but sometime it's pasting at one
place and some time at other...
is there a way to paste at specific x,y or near to cell B5?


Thanks you so much for your help.
musa.biralo