使用VBA选择Excel切片器值

时间:2018-02-17 21:28:07

标签: excel vba loops slicers

我正在尝试通过VBA中的切片器,这是我的代码:

ActiveWorkbook.SlicerCaches("Slicer_Customer_Name1").ClearManualFilter 'Opens the slicer we want to focus on
    With ActiveWorkbook.SlicerCaches("Slicer_Customer_Name1")
            For countCustomer = 1 To 100

            Sheet4.Cells(countCustomer, 3) = Sheet3.Cells(5, 1)
            prevCustomer = countCustomer - 1
                If countCustomer > 1 Then 
                .SlicerItems(countCustomer).Selected = True 
                .SlicerItems(prevCustomer).Selected = False 
                End If
            Next countCustomer

    End With

我想要做的是通过切片器并为每个不同的过滤值打印单元格A5中的值。我需要它来完成一个项目的代码,而这个项目只是基础。

0 个答案:

没有答案