Posts by max_max
-
-
Hi to all.
I found this macro in this forum:
Code- Option Explicit
- Sub UpdateChart()
- Dim i As Integer
- Dim lw As Long
- Dim lr As Long
- Dim sh As Worksheet
- Dim ws As Worksheet
- Set sh = Sheets("Table")
- Set ws = Sheets("Chart")
- lw = sh.Range("A" & Rows.Count).End(xlUp).Row
- lr = lw - 4
- ws.ChartObjects("Chart 1").Activate
- ActiveChart.ChartArea.Select
- With sh
- ActiveChart.SetSourceData _
- Source:=.Range(.Range("C" & lr & ":H" & lr), .Range("C" & lw & ":H" & lw)), PlotBy:=xlColumns
- For i = 2 To 6 'Headers to be added
- ActiveChart.SeriesCollection(i).Name = "=Table!R1C" & i + 1
- Next i
- ActiveChart.SeriesCollection(1).XValues = "=Table!R" & lr & "C1:R" & lw & "C1"
- End With
- End Sub
but I can't adapt it to my file.
I hope I explained myself
max