![]() |
Sizing a chart
I have a program part of which generates simple 2D XY line charts.
It does all the chart formatting €“ scales, color, labels etc, but I don't know how to size it. I believe that as it is embedded, I need to set up a class module to use "events". I've done this and it works ok, running automatically when I "run a chart." But what code can I put in the class module, to make the chart fill the area I require - ideally a range eg A200:G400? Any help would be greatly appreciated. Don W B -- donwb |
Sizing a chart
The following code will size a chartobject containing an embedded chart to
fit the nominated cell range: Set r = Range("A200:G400") Set co = ChartObjects(1) With co .Top = r.Top .Left = r.Left .Width = r.Width .Height = r.Height End With John Green - Excel MVP "donbowyer" wrote in message ... I have a program part of which generates simple 2D XY line charts. It does all the chart formatting - scales, color, labels etc, but I don't know how to size it. I believe that as it is embedded, I need to set up a class module to use "events". I've done this and it works ok, running automatically when I "run a chart." But what code can I put in the class module, to make the chart fill the area I require - ideally a range eg A200:G400? Any help would be greatly appreciated. Don W B -- donwb |
Sizing a chart
Many thanks John
So simple but so effective. It worked perfectly and without a class module. -- donwb "John Green" wrote: The following code will size a chartobject containing an embedded chart to fit the nominated cell range: Set r = Range("A200:G400") Set co = ChartObjects(1) With co .Top = r.Top .Left = r.Left .Width = r.Width .Height = r.Height End With John Green - Excel MVP "donbowyer" wrote in message ... I have a program part of which generates simple 2D XY line charts. It does all the chart formatting - scales, color, labels etc, but I don't know how to size it. I believe that as it is embedded, I need to set up a class module to use "events". I've done this and it works ok, running automatically when I "run a chart." But what code can I put in the class module, to make the chart fill the area I require - ideally a range eg A200:G400? Any help would be greatly appreciated. Don W B -- donwb |
All times are GMT +1. The time now is 07:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com