PC Review


Reply
Thread Tools Rate Thread

Chart Size & Position

 
 
Fan924
Guest
Posts: n/a
 
      21st Oct 2007
Excel 97 macro copies data blocks to a sheet and plots a graph. This
works well but the size and position is somwhat random. I would like
it to appear below the data array and be about the same size. Can that
be done?

Charts.Add
ActiveChart.ChartType = xlSurface
ActiveChart.SetSourceData Source:=Sheets("Test").Range("E" &
MapPasteTo + 27 & ":Q" & MapPasteTo + 39), _
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Test"

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q3JpbmdpbmcgRHJhZ29u?=
Guest
Posts: n/a
 
      21st Oct 2007
The following Methods can be used to modify the dimensions and position of a
ChartObject:
Height
Width
Top
Left

--
If a post answers your question, please mark it as the answer.


"Fan924" wrote:

> Excel 97 macro copies data blocks to a sheet and plots a graph. This
> works well but the size and position is somwhat random. I would like
> it to appear below the data array and be about the same size. Can that
> be done?
>
> Charts.Add
> ActiveChart.ChartType = xlSurface
> ActiveChart.SetSourceData Source:=Sheets("Test").Range("E" &
> MapPasteTo + 27 & ":Q" & MapPasteTo + 39), _
> PlotBy:=xlColumns
> ActiveChart.Location Where:=xlLocationAsObject, Name:="Test"
>
>

 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      21st Oct 2007
Sub ABC()
Dim ch As Chart
Charts.Add
MapPasteTo = 1
'Set r = Sheets("Test").Range("E" & _
MapPasteTo + 27 & ":Q" & MapPasteTo + 39)
ActiveChart.SetSourceData _
Source:=Sheets("Test").Range("E" & _
MapPasteTo + 27 & ":Q" & MapPasteTo + 39), _
PlotBy:=xlColumns
ActiveChart.ChartType = xlSurface
ActiveChart.Location Where:=xlLocationAsObject, Name:="Test"
Set ch = ActiveChart
With Worksheets("Test").Range("E" & MapPasteTo)
ch.Parent.Top = .Top
ch.Parent.Left = .Left
End With

End Sub

worked for me.

--
Regards,
Tom Ogilvy


"Fan924" wrote:

> Excel 97 macro copies data blocks to a sheet and plots a graph. This
> works well but the size and position is somwhat random. I would like
> it to appear below the data array and be about the same size. Can that
> be done?
>
> Charts.Add
> ActiveChart.ChartType = xlSurface
> ActiveChart.SetSourceData Source:=Sheets("Test").Range("E" &
> MapPasteTo + 27 & ":Q" & MapPasteTo + 39), _
> PlotBy:=xlColumns
> ActiveChart.Location Where:=xlLocationAsObject, Name:="Test"
>
>

 
Reply With Quote
 
Fan924
Guest
Posts: n/a
 
      21st Oct 2007
Worked great Tom. Thanks. I added 40 to the line count so it appears
below the data and added width and height. Exactly what I wanted!
With Worksheets("Test").Range("E" & MapPasteTo + 40)
ch.Parent.Top = .Top
ch.Parent.Left = .Left
ch.Parent.Width = 600
ch.Parent.Height = 300

 
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to change position of chart labels on line chart Shane Henderson Microsoft Excel Charting 1 27th May 2011 09:31 AM
Position a chart according to the position of the userform Gaetan Microsoft Excel Discussion 2 3rd Mar 2010 04:28 PM
how to draw crosshairs on a chart that go to the height and width of the chart and move with the cursor position? Steve Microsoft C# .NET 1 11th Sep 2006 02:41 PM
ho to change in the bubble chart the bubble position and size =?Utf-8?B?bGFzemxv?= Microsoft Excel Charting 0 25th Mar 2005 04:45 PM
Chart size/position Srikanth Ganesan Microsoft Excel Programming 1 1st Sep 2004 02:22 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:41 PM.