It won't like the zero in
Set XTemp = Range("C1").Resize(x, 0)
because you can't have a selection zero columns wide I think.
Also is x properly defined somewhere? I suspect you mean to use
amtrows there?
The line
ActiveChart.SetSourceData Source:=Sheets("Sheet5").Range(XTemp),
PlotBy _ :=xlColumns
will confuse vba as you've already defined XTemp as a range so
Range(Xtemp) may be a little dodgy.
Set the range to include sheet info as well:
Set XTemp = Sheets("Sheet5").Range("C1").Resize(amtrows, 1)
and change the SetSource line to:
ActiveChart.SetSourceData Source:=XTemp, PlotBy:=xlColumns
It also helps to be explicit about which sheet Range("A8") is on:
amtrows = Sheets("Sheet5").Range("A8").Value
Macro in full:
Dim amtrows As Long
Dim XTemp As Range
amtrows = Sheets("Sheet5").Range("A8").Value
Set XTemp = Sheets("Sheet5").Range("C1").Resize(amtrows, 1)
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=XTemp, PlotBy:=xlColumns
ActiveWindow.Visible = False