Pivot Table Show Details of Section in one Worksheet

swapnilk

Board Regular
Joined
Apr 25, 2016
Messages
75
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi all,

Please refer to thread: pivot tables and showdetail/drill down

I am trying to to get a drill down of multiple cells from a pivot table into the same sheet. The solution posted by charlie1105 works and shows the data of multiple rows in one sheet. However, after a few seconds the excel workbook crashes.

Here is the code:
VBA Code:
Sub DrillDownSpec()
Dim LRSource As Long, LRDest As Long
For Each cell1 In Selection
    cell1.ShowDetail = True
    If cellcounter = 0 Then
        ActiveSheet.Name = "PivotDrillDown"
    Else
        LRSource = ActiveSheet.Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
        LRDest = Sheets("PivotDrillDown").Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
        Range("A2:A" & LRSource).EntireRow.Copy Sheets("PivotDrillDown").Cells(LRDest, 1)
        Application.DisplayAlerts = False
        ActiveSheet.Delete
        Application.DisplayAlerts = True
        Sheets("PivotDrillDown").Select
    End If
cellcounter = cellcounter + 1
Next cell1
End Sub

Can someone please help with the workbook crashing after running the above code. I have tried in Excel 2021 and Excel 365. Also, is it possible to remove the headers in the PivotDrillDown sheet and make it a continuous table with a common header (doesn't matter if it losses pivot properties and is a normal table).

Thanks in advance!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,214,987
Messages
6,122,613
Members
449,090
Latest member
vivek chauhan

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