I have a problem to determine a dinamic range for a new chart being created from a macro.

the fact is that a previous macro generates the pivottable which is data source for the chart, but as it depens on a variables the size of the range everytime is different, so the range source should be dinamic in the macro as well.

This is a bit of code where is set the new chart creation:

Set Grafica1 = Sheets(customer & " Informe SLR").ChartObjects.Add(380, 1340, 310, 170)
Grafica1.Chart.ChartWizard Source:=Sheets(customer).Range("M4:P7,M1:N2")
Gallery:=xlColumn, Format:=4, PlotBy:=xlColumns, _
CategoryLabels:=1, SeriesLabels:=0, HasLegend:=1


Many thanks for your help,
BittyBite