I have written in two cells, "A367:A399" (Written in Cell T319) and "O367:O399" (Written in Cell T320). I want a macro to create a chart based on these ranges, without having to type the ranges in or select them. i had previously written this macro to graph based on my selection, but now i want to change that to graph based on X Axis (T319) and Y axis (T320). i do not know how to make the macro pull the text from the cell.


Sub graph()

Dim rngMyRange As Range
'Set rngMyRange = Selection


ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=rngMyRange
ActiveChart.Parent.Cut
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Paste
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.Shapes("Chart 1").ScaleWidth 2.5, msoFalse, _
msoScaleFromTopLeft
ActiveSheet.Shapes("Chart 1").ScaleHeight 2.5, msoFalse, _
msoScaleFromTopLeft
ActiveChart.ApplyLayout (5)

End Sub

Thanks