Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to create charts of various data sets using a calculated
dynamic range. However "SetSourceData Source" seems to be limited in the types of expression it will allow for ranges. For example: ActiveChart.SetSourceData Source:=Sheets("One").Range("D5:E29') is OK, but ActiveChart.SetSourceData Source:=Sheets("One").Range(Cells(5, 4), Cells(29, 5)), tells me that "Method 'Cells' of object '_Global' failed". I need to be able to use the second technique, or some variant of it. Could someone please suggest a work-around? (BTW, Sheets("One").Selection , where the selection has been pre-organised, also seems to be forbidden by VBA. Pity, that would have been an ideal solution) TIA |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
You need to fully qualify your objects. If this code is running whilst the activechart is a chart sheet then Cells object will fail. ActiveChart.SetSourceData _ Source:=Sheets("One").Range(Sheets("One").Cells(5, 4), _ Sheets("One").Cells(29, 5)) Cheers Andy jeh wrote: I'm trying to create charts of various data sets using a calculated dynamic range. However "SetSourceData Source" seems to be limited in the types of expression it will allow for ranges. For example: ActiveChart.SetSourceData Source:=Sheets("One").Range("D5:E29') is OK, but ActiveChart.SetSourceData Source:=Sheets("One").Range(Cells(5, 4), Cells(29, 5)), tells me that "Method 'Cells' of object '_Global' failed". I need to be able to use the second technique, or some variant of it. Could someone please suggest a work-around? (BTW, Sheets("One").Selection , where the selection has been pre-organised, also seems to be forbidden by VBA. Pity, that would have been an ideal solution) TIA -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Andy.
Cheers John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to decrease cell1 value if i increase cell2 value & visaversa | Excel Discussion (Misc queries) | |||
Cell1 must be blank before cell2 can except date | Excel Discussion (Misc queries) | |||
Is there a function, if cell1=Text then cell2=#? Excel 03 | Excel Worksheet Functions | |||
If Cell1 has something Cell2 is blank? | Excel Programming | |||
Chart creation ceiling in Excel 2002 via Chart.Add ? | Excel Programming |