 <p>Probably the following will work: </p> <pre><code>Sub getData() With ... .... End With LastRowColH = Range("H65536").End(xlUp).Row ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlXYScatter ActiveChart.SetSourceData Source:=Range("Sheet1!$D$3:$H$" &amp; CStr(LastRowColH)) End Sub </code></pre> <p>HTH!</p>