使用VBA中的数组值创建包含当前工作日和趋势线的图表

时间:2019-05-29 07:49:40

标签: excel vba charts excel-formula

我正在尝试使用包含当前工作日和趋势线的数组值在vba中制作图表,但我不知道从哪里开始。观看了很多教程,但仍然不知道从哪里开始。

我知道如何使用数组从数据透视表中获取数据,仅此而已。

Public Sub ReadToArrayErledigt()

    Dim pt As PivotTable
    Dim rg As Range
    Set pt = Worksheets("offen").PivotTables("PivotTable1")

    Set rg = pt.DataBodyRange

    Dim Done As Variant

    Done = rg.Value

    Dim i As Long, j As Long

    For i = LBound(Done, 1) To UBound(Done, 1)
        For j = LBound(Done, 2) To UBound(Done, 2)
            Debug.Print Done(i, j)
        Next j
    Next i

End Sub

Public Sub ReadToArrayErledigt2()

    Dim pt As PivotTable
    Dim rg As Range
    Set pt = Worksheets("offen").PivotTables("PivotTable2")
    Set rg = pt.DataBodyRange
    Dim Done As Variant


    Done = rg.Value

    Dim i As Long, j As Long

    For i = LBound(Done, 1) To UBound(Done, 1)
        For j = LBound(Done, 2) To UBound(Done, 2)
            Debug.Print Done(i, j)
        Next j
    Next i

End Sub

0 个答案:

没有答案