Hello Everyone!
I'm actually working on a VBA code to change the chart data source depending on the value of a cell.
My Charts are on a worksheet called "DashboardPropuesta" and my data source of the charts are on "'Base de Gráficos'".
This is the code that I am using but it keeps saying that I have a Range Error... could someone please tell me what I am doing wrong? I can't find the reason of the error.
I need your help! Thank you!!!
I'm actually working on a VBA code to change the chart data source depending on the value of a cell.
My Charts are on a worksheet called "DashboardPropuesta" and my data source of the charts are on "'Base de Gráficos'".
This is the code that I am using but it keeps saying that I have a Range Error... could someone please tell me what I am doing wrong? I can't find the reason of the error.
Code:
If Not Intersect(Target, Range("B3")) Is Nothing Then
If Range("B3").Value = "Real" Then
ActiveSheet.ChartObjects("IEDP").Chart.SetSourceData Source:=Range("'Base de Gráficos'!A2:D9,'Base de Gráficos'!B2:D9")
'Sheets("DashboardPropuesta").ChartObjects("IEDP").Activate
'ActiveChart.SetSourceData Source:=Range("'Base de Gráficos'!A2:A9,'Base de Gráficos'!B2:D9")
ElseIf Range("B3").Value = "Acumulado" Then
Sheets("DashboardPropuesta").ChartObjects("IEDP").Chart.SetSourceData Source:=Range("'Base de Gráficos'!$A$2:$A$9,'Base de Gráficos'!$E$2:$G$9")
End If
End If
End Sub
I need your help! Thank you!!!