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

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Watch MrExcel Video

Forum statistics

Threads
1,129,923
Messages
5,639,024
Members
417,063
Latest member
ShijinMathew

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