Hello,
I have a worksheet that has two charts with two slicers that filters data in those charts.
I was trying to copy and paste both the charts and the slicers to a new worksheet through a button.
I have this code:
But it only copies the charts and not the slicers. The slicers in the original worksheet still filter the data from the charts that were pasted into the new worksheet, but I would like to have them in this new worksheet.
I know that manually we can't copy and paste slicers, but isn't there a way to do it with VBA?
I have searched everywhere and haven't found anything.
Thank you.
I have a worksheet that has two charts with two slicers that filters data in those charts.
I was trying to copy and paste both the charts and the slicers to a new worksheet through a button.
I have this code:
VBA Code:
Private Sub CommandButton1_Click()
Workbooks("original_worksheet.xlsx").Worksheets("Chart").Range("A1:AB39").Copy
Sheets("new_worksheet").Activate
Range("A4").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
But it only copies the charts and not the slicers. The slicers in the original worksheet still filter the data from the charts that were pasted into the new worksheet, but I would like to have them in this new worksheet.
I know that manually we can't copy and paste slicers, but isn't there a way to do it with VBA?
I have searched everywhere and haven't found anything.
Thank you.