PC Review Forums Newsgroups Microsoft Excel Microsoft Excel Charting Creating and setting location for Excel Charts

Reply

Creating and setting location for Excel Charts

 
Thread Tools Rate Thread
Old 04-07-2003, 07:52 AM   #1
Zzzbla
Guest
 
Posts: n/a
Default Creating and setting location for Excel Charts


Hi!

I have to write some code that's supposed to create a report in Excel,
where some of the reports will contain more charts and some less (because
they have less data) and I have to create the charts programmatically
ofcourse.

My problem is that I couldn't figure out how to set the location of the
chart so it will be for example under a sepcific row in the sheet.

Please post an answer!

Thanks in advance!
  Reply With Quote
Old 04-07-2003, 08:54 AM   #2
Andy Pope
Guest
 
Posts: n/a
Default Re: Creating and setting location for Excel Charts

Hi Zzzbla,

Use something like this,

ActiveSheet.ChartObjects(1).Left = Range("E5").Left
ActiveSheet.ChartObjects(1).Top = Range("E5").Top


Zzzbla wrote:
> Hi!
>
> I have to write some code that's supposed to create a report in Excel,
> where some of the reports will contain more charts and some less (because
> they have less data) and I have to create the charts programmatically
> ofcourse.
>
> My problem is that I couldn't figure out how to set the location of the
> chart so it will be for example under a sepcific row in the sheet.
>
> Please post an answer!
>
> Thanks in advance!


--

Cheers
Andy

http://www.andypope.info

  Reply With Quote
Old 06-07-2003, 08:54 AM   #3
Zzzbla
Guest
 
Posts: n/a
Default Re: Creating and setting location for Excel Charts

Thanks a bunch!

I didn't figure there's a difference between Chart and ChartObject...

Almost copied charts to Word as a last resort...

Thanks again,
Zzzbla



In article <eJ$v6hgQDHA.2176@TK2MSFTNGP12.phx.gbl>, andy@andypope.info
says...
> Hi Zzzbla,
>
> Use something like this,
>
> ActiveSheet.ChartObjects(1).Left = Range("E5").Left
> ActiveSheet.ChartObjects(1).Top = Range("E5").Top
>
>
> Zzzbla wrote:
> > Hi!
> >
> > I have to write some code that's supposed to create a report in Excel,
> > where some of the reports will contain more charts and some less (because
> > they have less data) and I have to create the charts programmatically
> > ofcourse.
> >
> > My problem is that I couldn't figure out how to set the location of the
> > chart so it will be for example under a sepcific row in the sheet.
> >
> > Please post an answer!
> >
> > Thanks in advance!

>
>

  Reply With Quote
Old 08-07-2003, 03:47 AM   #4
Jon Peltier
Guest
 
Posts: n/a
Default Re: Creating and setting location for Excel Charts

To augment Andy's much more prompt response.

You can set the position and size of a chart when creating it in VBA.

Dim myChtObj As Chart Object
With ActiveSheet
Set myChtObj = .ChartObjects.Add(.Range("E5").Left, _
.Range("E5").Top, .Range("E5:L22").Width, _
.Range("E5:L22").Height)
End With

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

Andy Pope wrote:
> Hi Zzzbla,
>
> Use something like this,
>
> ActiveSheet.ChartObjects(1).Left = Range("E5").Left
> ActiveSheet.ChartObjects(1).Top = Range("E5").Top
>
>
> Zzzbla wrote:
>
>> Hi!
>>
>> I have to write some code that's supposed to create a report in Excel,
>> where some of the reports will contain more charts and some less
>> (because they have less data) and I have to create the charts
>> programmatically ofcourse.
>> My problem is that I couldn't figure out how to set the location of
>> the chart so it will be for example under a sepcific row in the sheet.
>>
>> Please post an answer!
>>
>> Thanks in advance!

>
>


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off