View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
gvm gvm is offline
external usenet poster
 
Posts: 38
Default Dynamic sizing of a chart object

Thanks Jon.
I have an issue integrating your new statement in place of the old
Charts.Add statement. This is an excerpt of the code:
With Worksheets("Traffic model")
.ChartObjects.Add .Range("G1").Left, .Range("G1").Top,
..Range("G1:k11").Width, .Range("G1:k11").Height
Set YRng = .Range(.Cells(initial_blank_count - 1, initial_column +
6), .Cells(LastRow, initial_column + 6))
Set XRng = .Range(.Cells(initial_blank_count - 1, initial_column),
..Cells(LastRow, initial_column))
With ActiveChart
.ChartType = xlLine
.SetSourceData Source:=YRng, PlotBy:=xlColumns

Debug highlights the error line to be "With ActiveChart". The error is
"Object variable or with block variable not set". If I insert a period in
front of ActiveChart, I receive the error "Object doesn't support this
property or method".

Can you advise the problem please, TIA ... Greg