zoukankan      html  css  js  c++  java
  • 【VBA】制作散点图及打标签VBA

    1、散点图的制作必须只选择xy轴对应的数据,不能选中标签。

    2、调整xy轴交叉点,改为四个象限。

    3、通过菜单移动散点图到新表。

    4、运行宏,打上文本标签。

    VBA如下

     1 Sub AttachLabelsToPoints()
     2 
     3    'Dimension variables.
     4    Dim Counter As Integer, ChartName As String, xVals As String
     5 
     6    ' Disable screen updating while the subroutine is run.
     7    Application.ScreenUpdating = False
     8 
     9    'Store the formula for the first series in "xVals".
    10    xVals = ActiveChart.SeriesCollection(1).Formula
    11 
    12    'Extract the range for the data from xVals.
    13    xVals = Mid(xVals, InStr(InStr(xVals, ","), xVals, _
    14       Mid(Left(xVals, InStr(xVals, "!") - 1), 9)))
    15    xVals = Left(xVals, InStr(InStr(xVals, "!"), xVals, ",") - 1)
    16    Do While Left(xVals, 1) = ","
    17       xVals = Mid(xVals, 2)
    18    Loop
    19 
    20    'Attach a label to each data point in the chart.
    21    For Counter = 1 To Range(xVals).Cells.Count
    22      ActiveChart.SeriesCollection(1).Points(Counter).HasDataLabel = _
    23          True
    24       ActiveChart.SeriesCollection(1).Points(Counter).DataLabel.Text = _
    25          Range(xVals).Cells(Counter, 1).Offset(0, -1).Value
    26    Next Counter
    27 
    28 End Sub
  • 相关阅读:
    CCNode作为容器实现显示区域剪裁
    使用CCNode作为容器容易踩的坑
    走了很多弯路的CCScrollView
    常用es6特性归纳-(一般用这些就够了)
    WebP图片优化
    es6 Promise 异步函数调用
    网站性能优化
    dom元素分屏加载
    js顺序加载与并行加载
    移动端真机调试
  • 原文地址:https://www.cnblogs.com/colipso/p/3718051.html
Copyright © 2011-2022 走看看