Thread
:
VBA code problem
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett[_4_]
external usenet poster
Posts: 2,337
VBA code problem
Untested but try adding the sheet to your second part of the range.
or use something like
x=1st range
y=2nd range
source=range(x&":"&y)
--
Don Guillett
SalesAid Software
"excelnoob " wrote in message
...
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.SetSourceData
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.SetSourceData
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 creating
the chart that works in example 1?
Thank you for your help
---
Message posted from
http://www.ExcelForum.com/
Reply With Quote
Don Guillett[_4_]
View Public Profile
Find all posts by Don Guillett[_4_]