Hello im using this VBA code that makes my chart dynamic.
<code>I type it in VBA in Sheet 1 where the data source is. If the chart is there too it will work perfectly. But i want to put the chart in Sheet2. Can you help me do this?
Also K2 and L2 keep the values that show how much columns and rows should the chart take from the table. I want to keep them too in Sheet1. THe only thing in sheet2 has to be the chart.
</code>
Code:
<code>Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("K2:L2")) Is Nothing Then
With Me
.ChartObjects("Chart 1").Activate
ActiveChart.SetSourceData Source:=.Range(.Cells(1, 1), .Cells(1 + [K2].Value, 1 + [L2].Value))
End With
End If
End Sub</code>
Also K2 and L2 keep the values that show how much columns and rows should the chart take from the table. I want to keep them too in Sheet1. THe only thing in sheet2 has to be the chart.
</code>
Last edited: