我想捕获基于切片器选择的方案

时间:2019-04-25 14:20:27

标签: excel vba

我想捕获从切片器中选择的数据以及选定的切片器值的详细信息

我能够复制数据,但不能复制切片器值

Private Sub CommandButton1_Click()
    Application.ScreenUpdating = False
    Dim xSheet As Worksheet
    Dim lRow As Long
    Dim ws As Worksheet
    Set ws = ActiveWorkbook.Sheets("Sheet2")
    lRow = ws.Cells(Rows.Count, "A").End(xlUp).Row + 1
    Set xSheet = ActiveSheet
        If xSheet.Name = "Sheet1" Then
            xSheet.Range("A1:B5").Copy
            ws.Range("A" & lRow).PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
        End If
    Application.ScreenUpdating = True
End Sub

获取切片器值以及数据

0 个答案:

没有答案