sdmikejr
03-11-2018, 11:33 AM
I have searched and while I have found instances that are almost there - I cannot seem to fit them any of them in my VBA solution that work.
Here's the deal. I have test data coming from a machine that where the output of the row and column count can change.
I am trying to use VBA to create a chart, regardless of the column and row count, to plot the results.
Where I am getting stuck is I cannot seem to find an acceptable approach to determine the range being somewhat dynamic.
Can someone please help me?
Sub GetChart()Dim MyChart As Chart
Dim DataRange As Range
Set DataRange = ActiveSheet.Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Set MyChart = ActiveSheet.Shapes.AddChart2.Chart
MyChart.SetSourceData
Source:=DataRange
End Sub
Here's the deal. I have test data coming from a machine that where the output of the row and column count can change.
I am trying to use VBA to create a chart, regardless of the column and row count, to plot the results.
Where I am getting stuck is I cannot seem to find an acceptable approach to determine the range being somewhat dynamic.
Can someone please help me?
Sub GetChart()Dim MyChart As Chart
Dim DataRange As Range
Set DataRange = ActiveSheet.Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Set MyChart = ActiveSheet.Shapes.AddChart2.Chart
MyChart.SetSourceData
Source:=DataRange
End Sub