【问题标题】:Get data from an excel chart/graph从 excel 图表/图形中获取数据
【发布时间】:2013-08-19 09:13:06
【问题描述】:

我有一个 MS excel 2010 图表,显示男孩的身高(y 轴)与年龄(x 轴)

到底有没有用数据的形式来表示图?

我的问题是,给定 excel 中的任何图表,如果您没有从中制作/创建它的数据表,您可以自己从可用的图表中创建数据表吗?

【问题讨论】:

标签: excel charts excel-2010


【解决方案1】:

只需按照以下步骤操作:

第 1 步:将以下代码复制到 VBA 模块中:

Sub GetChartValues()  
   Dim NumberOfRows As Integer  
   Dim X As Object  
   Dim Counter as Integer  
   Counter = 2  

   ' Calculate the number of rows of data.  
   NumberOfRows = UBound(ActiveChart.SeriesCollection(1).Values)  

   Worksheets("ChartData").Cells(1, 1) = "X Values"  

   ' Write x-axis values to worksheet.  
   With Worksheets("ChartData")  
      .Range(.Cells(2, 1), _  
      .Cells(NumberOfRows + 1, 1)) = _  
      Application.Transpose(ActiveChart.SeriesCollection(1).XValues)  
   End With  

   ' Loop through all series in the chart and write their values to  
   ' the worksheet.  
   For Each X In ActiveChart.SeriesCollection  
      Worksheets("ChartData").Cells(1, Counter) = X.Name  

      With Worksheets("ChartData")  
        .Range(.Cells(2, Counter), _  
         .Cells(NumberOfRows + 1, Counter)) = _  
         Application.Transpose(X.Values)  
      End With  

      Counter = Counter + 1  
   Next  
End Sub

第 2 步:将新工作表重命名为 Chartdata

第 3 步:选择要从中获取值的图表

第 4 步:运行宏

第 5 步:查看工作表 Chartdata,您的价值观在那里

参考:MS Office 网站

【讨论】:

    猜你喜欢
    • 2017-03-29
    • 1970-01-01
    • 1970-01-01
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-01
    • 1970-01-01
    相关资源
    最近更新 更多