I want to automatically select each item in the slicer, select the first item, copy the data and paste to another sheet, then select the next item in the slicer and copy the data and paste to another sheet, and so on until the last item in the slicer.
the vba code I use for copy and pasting is below:
Private Sub CommandButton1_Click()
Sheets("Sheet1").Select
Range("e3:f3").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial
Paste:=xlPasteValues
End Sub