View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
excelnoob[_2_] excelnoob[_2_] is offline
external usenet poster
 
Posts: 1
Default VBA code problem

Please help me. I'm banging my head against the wall with this one
Range C33 is 12 and D33 is 24, both are variables

Why this one doesn't work? the prolem is with the data source

Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceDat
Source:=Sheets("sheet1").Range(Range("C37").Offset (Range("C33"), 0)
Range("C37").Offset(Range("D33"), 2)), PlotBy :=xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:="sheet2"

And this one does?

Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceDat
Source:=Sheets("sheet1").Range("C49:E61")PlotBy :=xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:="sheet2"


The chart source area is this:

Range(Range("C37").Offset(Range("C33"), 0)
Range("C37").Offset(Range("D33"), 2))

This works fine in example 1:

Range(Range("C37").Offset(Range("C33"), 0)
Range("C37").Offset(Range("D33"), 2)).Select
With Selection.Interior
.ColorIndex = 5
.Pattern = xlSolid
End With

So my question is why the same area defining doesn't work in creatin
the chart that works in example 1?

Thank you for your hel

--
Message posted from http://www.ExcelForum.com