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