You'll have better results if you use ActiveSheet.ChartObjects.Add instead
of Charts.Add, because it puts the chart directly on the sheet without
creating an intermediate chart sheet. The technique is discussed on this web
page:
http://peltiertech.com/Excel/ChartsH...kChartVBA.html
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______
"Jaylin" wrote in message
...
Dear Sir
Thank you very much for your fast life saving advice.
One major problem I have is that I want the VB to create many charts in
the
same data sheet.
Therefore, the name of the chart will change after each run.
I wonder I can I define a dynamic name range after
"ActiveSheets.shapes."?????"
The following is part of my code
Dim r As Integer
r = 9
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("TOP DMA OB
VIETNAM.").Range( _
Sheets("TOP DMA OB VIETNAM.").Cells(r, 8), Sheets("TOP DMA OB
VIETNAM.").Cells(r, 20)), PlotBy:=xlRows
ActiveChart.SeriesCollection(1).XValues = "='TOP DMA OB
VIETNAM.'!r6c13:r6c25"
ActiveChart.Location Whe=xlLocationAsObject, Name:="TOP DMA OB
VIETNAM."
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = Sheets("TOP DMA OB
VIETNAM.").Cells(r,
5)
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
With ActiveSheet.Shapes(Sheets("TOP DMA OB VIETNAM.").Cells(r, 5))
.Top = Range("C2").Top
.Left = Range("C3").Left
End With
--
Thanks a million for your time and expert advice :-)
Jaylin
*****Jaylin Message ended*******
"Jaylin" wrote:
I would like to generate a chart within the same datasheet at a defined
position.
With my limited VB knowledge, the chart is generated at a default
position
each time
Would appreciate expert advice
--
Thanks a million for your time and expert advice :-)
Jaylin
*****Jaylin Message ended*******