LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Charts and Userforms

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UserForms bennyob Excel Discussion (Misc queries) 4 November 7th 05 01:58 PM
Esc out of userforms Mark \(InWales\)[_23_] Excel Programming 2 February 2nd 05 10:08 PM
Charts & Graphs on Userforms. Andy Pope Excel Programming 0 August 22nd 03 09:54 AM
Userforms Gary[_8_] Excel Programming 1 August 18th 03 03:26 PM
Userforms Henry[_4_] Excel Programming 0 August 9th 03 11:37 PM


All times are GMT +1. The time now is 04:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"