Pivot table question

counterscc

Board Regular
Joined
Mar 6, 2006
Messages
119
In a pivot table I am able to double click within the Pivot Table Values area and in doing so it opens a seperate tab within that same workbook with just the info I double clicked on. Is there a way so that when I double click in the Pivot Table Values area it opens in a whole new workbook as oppsed to just another tab in that same workbook? Any help would be greatly appreciated. Thanks
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Counterscc,

Important: make a copy of your workbook first.

Try this:

1. Copy the code below.


Code:
Private Sub Worksheet_BeforeDoubleClick( _
        ByVal Target As Range, Cancel As Boolean)
    Dim myName As String
 
    myName = ActiveSheet.Name
    On Error Resume Next
    Selection.ShowDetail = True
 
    If myName <> ActiveSheet.Name Then
        ActiveSheet.Move
    End If
End Sub

2. Click with the right mouse button on the tab of the worksheet containing the pivot table and choose View Code on the menu that appears.

3. A VBA window appears, paste the code you copied in step 1 in the VBA window.

4. Test on the sheet with the PivotTable.

Markmzz
 
Upvote 0
Counterscc,

Only a patch (in red in the code below).

Code:
Private Sub Worksheet_BeforeDoubleClick( _
        ByVal Target As Range, Cancel As Boolean)
    Dim myName As String
 
    myName = ActiveSheet.Name
    On Error Resume Next
    Selection.ShowDetail = True
 
   [COLOR=red][B]On Error GoTo 0[/B][/COLOR]
    
    If myName <> ActiveSheet.Name Then
        ActiveSheet.Move
    End If
End Sub

Markmzz
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,707
Members
452,939
Latest member
WCrawford

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
Back
Top