Relative Reference and Graphs

CasMarie

New Member
Joined
May 5, 2011
Messages
1
Hi Folks,

So my problem. I want to create graphs from data tables in excel. Although these tables could potentially have different numbers of rows and columns (annnd I have to make a lot of them). Therefore my plan was to highlight the data table and then be able to run a macro that would create a graph from the active array with the all the specific formatting I need. I attempted to record a macro with the relative reference on the but chart part of the code references a specific range and I do not know how to change this. Below is my sad attempt. Any and all help would be greatly appreciated.

Sub makechart()

range(Selection, Selection.End(xlToRight)).Select
range(Selection, Selection.End(xlDown)).Select
Charts.Add
ActiveChart.ChartType = xlXYScatterLinesNoMarkers
ActiveChart.SetSourceData Source:=Sheets("TEST").range("A3:D13"), PlotBy:= _
xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="TEST"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub

Thanks
cas
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,224,502
Messages
6,179,126
Members
452,890
Latest member
Nikhil Ramesh

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