Hi
I have a sheet (excel 2007), where I would like to copy an entire section of the sheet and paste it further down. This section includes a chart, whose sourcedata I would automatically like to change, when running the macro to do the copy/pasting.
If the original data for the Pie chart is in range("B11:C16") and I wish to change this to range("B41:B46"), I would think I could simply do the following:
Charts("ChartName").SetSourceData Source:=Activesheet.Range("B41:C46")
This however gives me an error saying "subscript out of range". Using named ranges will not be necessary (or usefull in this context), I basically just take a section of the worksheet, paste it alittle further down and type in the needed data. Everything but this changing of the source works perfectly, so I am getting alittle frustrated. Hope you can help!
Thanks in advance
Peter
I have a sheet (excel 2007), where I would like to copy an entire section of the sheet and paste it further down. This section includes a chart, whose sourcedata I would automatically like to change, when running the macro to do the copy/pasting.
If the original data for the Pie chart is in range("B11:C16") and I wish to change this to range("B41:B46"), I would think I could simply do the following:
Charts("ChartName").SetSourceData Source:=Activesheet.Range("B41:C46")
This however gives me an error saying "subscript out of range". Using named ranges will not be necessary (or usefull in this context), I basically just take a section of the worksheet, paste it alittle further down and type in the needed data. Everything but this changing of the source works perfectly, so I am getting alittle frustrated. Hope you can help!
Thanks in advance
Peter