Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to create a number of charts using VBA, but positioning the
charts is giving me trouble. Thanks in advance for any help. My code: Set myChart = Charts.Add ActiveChart.ChartType = xlXYScatterLines ActiveChart.SetSourceData Source:=Sheets("Graph").Range(GraphRange), PlotBy:=xlColumns ActiveChart.Location Whe=xlLocationAsObject, Name:="Graph" With myChart.Parent .Top = Range("C2").Top .Left = Range("C2").Left End With Error: Run-time error '424' Object required |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() With ActiveChart.Parent .Top = Range("C2").Top .Left = Range("C2").Left End With mychart doesn't represent chart after changing location and only Microsoft knows why. mike wrote: I am trying to create a number of charts using VBA, but positioning the charts is giving me trouble. Thanks in advance for any help. My code: Set myChart = Charts.Add ActiveChart.ChartType = xlXYScatterLines ActiveChart.SetSourceData Source:=Sheets("Graph").Range(GraphRange), PlotBy:=xlColumns ActiveChart.Location Whe=xlLocationAsObject, Name:="Graph" With myChart.Parent .Top = Range("C2").Top .Left = Range("C2").Left End With Error: Run-time error '424' Object required |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() -- --- Regards, Norman "mike" wrote in message ... I am trying to create a number of charts using VBA, but positioning the charts is giving me trouble. Thanks in advance for any help. My code: Set myChart = Charts.Add ActiveChart.ChartType = xlXYScatterLines ActiveChart.SetSourceData Source:=Sheets("Graph").Range(GraphRange), PlotBy:=xlColumns ActiveChart.Location Whe=xlLocationAsObject, Name:="Graph" With myChart.Parent .Top = Range("C2").Top .Left = Range("C2").Left End With Error: Run-time error '424' Object required |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mike,
Try something like: '============= Public Sub Tester() Dim SH As Worksheet Dim rng As Range Dim myChart As ChartObject Set SH = Sheets("Graph") Set rng = SH.Range("GraphRange") Set myChart = SH.ChartObjects.Add(Left:=SH.Range("C2").Left, _ Top:=SH.Range("C2").Top, _ Width:=300, _ Height:=200) '<<=== CHANGE With myChart.Chart .ChartType = xlXYScatterLines .SetSourceData Source:=rng, PlotBy _ :=xlColumns End With End Sub '<<============= --- Regards, Norman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Positioning charts & pictures with data for printing | Excel Discussion (Misc queries) | |||
Positioning all pictures | Excel Discussion (Misc queries) | |||
Commandbar Positioning | Excel Programming | |||
Positioning | Excel Programming | |||
= positioning | Excel Programming |