lundi 20 avril 2015

VBA Code to shift sourcedata in an excel chart

I am trying to update my sourcedata in a chart. I Don't want a dynamic range because the chart will pull each time from the new range with each button click. If I use a dynamic or named range, I am locked into that range.

I have tried:

ActiveSheet.ChartObjects("Chart 2").Activate

ActiveChart.PlotArea.Select

ActiveChart.SetSourceData Source:=Range("A1:C3").Offset(0,3)

This only works once, though. To be clear, I have a button to update a chart on a spreadsheet. When the button is clicked, the macro will look at the current data in the active chart and shift the source over 3 columns. This will happen each time the button is clicked and the data must stay on the sheet. I've exhausted everything I know and can find online the Goracle search.

Any help?

Thanks in advance, Lilith

Aucun commentaire:

Enregistrer un commentaire