New window after pivot table drill down + additional manipulation

kevdragon1

New Member
Joined
Mar 8, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hi all,

I am new to VBA.

I want to be able to double click a pivot table and the results to pop out in a new window. I searched this forum and found this code that works great (I put it in ThisWorkbook):

Private Sub Workbook_NewSheet(ByVal Sh As Object)
Sh.Move
End Sub

After that, I would like to copy and paste data from this new window and do additional manipulation but my only problem is that I can't seem to define the new workbook opens. I tried so many things but I can't do anything without having an error. Basically, I can't do anything with ranges (insert tables, autofilter) because this new workbook that was created from the code is not the active one and I don't know how to activate the sheet that will always have a different name. I tried wbname = activeworkbooks and wsname = activesheet but this doesn't work and I suspect it has something to do with the Sh as Object at the start of the code.

Can anyone help me?

Thanks
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Watch MrExcel Video

Forum statistics

Threads
1,130,144
Messages
5,640,388
Members
417,140
Latest member
whiteprose

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top