kevdragon1
New Member
- Joined
- Mar 8, 2021
- Messages
- 21
- Office Version
- 365
- Platform
- 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):
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
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