View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Positioning of Chart Objects on an Excel Sheet

eg -

Sub test()
Dim j As Long, k As Long
Dim chtObj As ChartObject
Dim cht As Chart
Dim sr As Series

For k = 2 To 2 + (5 * 3) Step 5

For j = 2 To 2 + (10 * 4) Step 10
Set rng = Range(Cells(j, k), Cells(j + 7, k + 3))

With rng

Set chtObj = ActiveSheet.ChartObjects.Add(.Left, .Top, .Width, .Height)
Set cht = chtObj.Chart
Set sr = cht.SeriesCollection.NewSeries
sr.Values = "{1,2,3}"

End With

Next
Next

End Sub

Peter T


"Peter T" <peter_t@discussions wrote in message
...
Hi Chris,

Dim chtObj as ChartObject
dim cht as Chart

Set chtObj = ActiveSheet.ChartObjects.Add(L, T, W, H)
Set cht = chtObj.Chart

and go on to add whatever to 'cht'

The coordinates might be those of a range to line up with cells, or

whatever
position and size you require.

Regards,
Peter T


"Chris Gorham" wrote in message
...
Hi,

I've written a graph plotting program that outputs the charts either as

new
sheets in the workbook or alternatively as objects placed in order on a

new
worksheet.

I'm having difficulty persuading the code to place the charts in a neat
order on the sheet...

Is it possible to link the chart object to a cell range rather than

specify
coordinates...??

Thanks...Chris