PC Review
Forums
Newsgroups
Microsoft Excel
Microsoft Excel Charting
Creating and setting location for Excel Charts
Forums
Newsgroups
Microsoft Excel
Microsoft Excel Charting
Creating and setting location for Excel Charts
![]() |
Creating and setting location for Excel Charts |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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! |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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! > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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! > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 


