Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you use an image, it's faster but it also leaves a transparent
'border.' If you use a chart, it is fractionally slower but can be aligned flush with various edges. To align the copied object with top-left of A2 and bottom-right of H24, use: Sub testPicture() Worksheets("sheet1").ChartObjects("Chart 1").Chart.CopyPicture _ Appearance:=xlPrinter, Size:=xlScreen, Format:=xlPicture With Worksheets("Sheet2") Do While .Shapes.Count 0: .Shapes(1).Delete: Loop .Paste .Shapes(1).Left = .Range("a2").Left .Shapes(1).Top = Range("a2").Top .Shapes(1).Width = Range("i24").Left - Range("a2").Left .Shapes(1).Height = Range("h25").Top - Range("a2").Top End With End Sub Sub testChartObject() Worksheets("sheet1").ChartObjects("Chart 1").Copy With Worksheets("Sheet2") Do While .ChartObjects.Count 0: .ChartObjects(1).Delete: Loop .Paste .ChartObjects(1).Left = .Range("a2").Left .ChartObjects(1).Top = Range("a2").Top .ChartObjects(1).Width = Range("i24").Left - Range("a2").Left .ChartObjects(1).Height = Range("h25").Top - Range("a2").Top End With End Sub -- Regards, Tushar Mehta www.tushar-mehta.com Multi-disciplinary business expertise + Technology skills = Optimal solution to your business problem Recipient Microsoft MVP award 2000-2005 In article .com, says... Thanks a lot. It works, but I need to modify my chart size. I would like my chart to fit in the range of A2:H24. How can I make sure my chart always fits in that range? I also implemented the code to delete a chart that is already there. Thanks for the tip. After trying your code sample ... the loading of the chart is a bit slower than with a userform. Is there anything else I could implement that might help? Thanks, Julia |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
UserForms | Excel Discussion (Misc queries) | |||
Esc out of userforms | Excel Programming | |||
Charts & Graphs on Userforms. | Excel Programming | |||
Userforms | Excel Programming | |||
Userforms | Excel Programming |