Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50090

Plotting graph with vba

$
0
0
Hi all, i have an error setting a range for my graph. Currently my code looks like this. Any solutions? Thanks in advance

Code:

Dim r As Range
set r = Range(Selection, Selection.End(xlToRight).Offset(0, -1))

    Charts.Add
  ActiveChart.ChartType = xlColumnClustered
    ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range(r), PlotBy _
        :=xlRows
    ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R12C4:R12C15"
    ActiveChart.SeriesCollection(1).Name = "=Sheet1!R14C3"
    ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
    ActiveChart.HasLegend = False
    ActiveChart.HasDataTable = False


Viewing all articles
Browse latest Browse all 50090

Trending Articles