Chart Source data

mk000

Board Regular
Joined
Dec 10, 2004
Messages
234
How do you make a chart's source data shift one cell to the right via macro?

Example....

____A______B_______C_______D________E
1_________JAN_____FEB_____MAR______APR
2 USA____5_______4_______3________2

Say the current data on the chart is USA's JAN - MAR, with the macro, it's now FEB-APR


Thanks!
 

Some videos you may like

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

sweater_vests_rock

Well-known Member
Joined
Oct 8, 2004
Messages
1,657
mk000.

Use the SetSourceData Method. From the Help File:

SetSourceData Method

Sets the source data range for the chart.

expression.SetSourceData(Source, PlotBy)

expression Required. An expression that returns a Chart object.

Source Required Range. The range that contains the source data.

PlotBy Optional Variant. Specifies the way the data is to be plotted. Can be either of the following XlRowCol constants: xlColumns or xlRows.

Example
This example sets the source data range for chart one.

Code:
Charts(1).SetSourceData Source:=Sheets(1).Range("a1:a10"), _
    PlotBy:=xlColumns[/quote]
 

mk000

Board Regular
Joined
Dec 10, 2004
Messages
234
can you demonstrate a macro to shift the cells one cell?

???
 

Watch MrExcel Video

Forum statistics

Threads
1,127,086
Messages
5,622,614
Members
415,913
Latest member
1000rr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top