when i run this code in to this worksheet i face with this error .ChartObjects("Chart 2").Chart.SetSourceData Source:=.Range(.Cells(1, i), .Cells(lr, i + 1)) highlighted
Code:
Sub blah()
With ThisWorkbook.Worksheets("min max & march of khamir")
For i = 1 To 61 Step 2
lr = .Cells(Rows.Count, i + 1).End(xlUp).Row
.ChartObjects("Chart 2").Chart.SetSourceData Source:=.Range(.Cells(1, i), .Cells(lr, i + 1))
.ChartObjects("Chart 2").Chart.Export ThisWorkbook.Path & Application.PathSeparator & "d" & Format(.Cells(1, i + 1).Value, "yymmdd") & ".PNG"
Next i
End With
End Sub
Bookmarks