testuser448
New Member
- Joined
- Nov 25, 2015
- Messages
- 2
No doubt this question has been asked already, but I could not find it.
You can set the source data like this:
Given myChart, how can I get myRange? Unfortunately there is no Chart.GetSourceData. I want everything including row and column headings (A1:E5 in the example spreadsheet below):
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]Q1[/TD]
[TD]Q2[/TD]
[TD]Q3[/TD]
[TD]Q4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Region1[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Region2[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Region3[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Region4[/TD]
[TD]400[/TD]
[TD]400[/TD]
[TD]400[/TD]
[TD]400[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
You can set the source data like this:
Code:
Dim myChart As Excel.Chart
Dim myRange as Excel.Range
' Initialise chart and range objects and then
myChart.SetSourceData myRange 'myRange = A1:E5
Given myChart, how can I get myRange? Unfortunately there is no Chart.GetSourceData. I want everything including row and column headings (A1:E5 in the example spreadsheet below):
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]Q1[/TD]
[TD]Q2[/TD]
[TD]Q3[/TD]
[TD]Q4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Region1[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Region2[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Region3[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD]300[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Region4[/TD]
[TD]400[/TD]
[TD]400[/TD]
[TD]400[/TD]
[TD]400[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]