Active Chart Source data based on column data

macfam929

New Member
Joined
Jul 28, 2010
Messages
13
Hi. I am relatively new to the VB Macro's. I am trying to write a macro that creates a graph. I have everything working except i want to be able to format which data it graphs.
My data currently looks like this:
Column B Column C Column D .... Column M
0 0 20 40
0 0 21 45
5 0 22 50
10 5 23 80
20 7 24 100
50 9 25 105

My current code is:
Charts.Add
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.SetSourceData Source:=dataRng, PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Temp Graph"

What I want to do is instead of having the Source be dataRng and graph all columns all rows, to have it start graphing all columns (B-M) only after Column B is greater then 0. I can not delete the first few rows as they are used in other graphs.

Any help you could give on this would be greatly appreciated!! Thank you.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,219,161
Messages
6,146,657
Members
450,706
Latest member
LGVBPP

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
Back
Top