View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jaylin Jaylin is offline
external usenet poster
 
Posts: 29
Default ???How to set chart position


Thank you very much Mr NickHK
I ve tried to test a few code first but get complie error. HOpe you would
not mind to futher advice

Set cht = Charts.Add
With cht
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=......
ActiveChart.SeriesCollection(1).XValues = .......
ActiveChart.Location Whe=xlLocationAsObject, Name......
.Top = Range(a1, a3).Top
End With
--
Thanks a million for your time and expert advice :-)
Jaylin
*****Jaylin Message ended*******


"NickHK" wrote:

Loop through you code however many times, moving down CHARTHEIGHT each time:
Dim i as Long
Dim cht as Chart
Const CHARTHEIGHT As single=100
For i =1 to RequiredCharts
Set cht=Charts.add
With cht
'Do your chart stuff
.Top = Range("C2").Offset(i*CHARTHEIGHT,0).Top
.Left = Range("C3").Left
End With
Next

NickHK

"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*******