Reputation: 69
So basically I need to be able to select the last row to create a chart using this method.
Sub createchart2()
lastA = Range("A1").End(xlDown).Row
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Range("Main!$A$3:$A$10")
End Sub
I need the range for A10
to be able to select the last row in the A column.
Upvotes: 3
Views: 3322
Reputation: 149287
Is this what you are trying?
Sub createchart2()
Dim lastA As Long
lastA = Range("A" & Rows.Count).End(xlUp).Row
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Range("Main!$A$3:$A$" & lastA)
End Sub
Upvotes: 3