" .Showdetail = True " not running with F5 when cell on PowerPivot table selected

e076841

New Member
Joined
May 1, 2013
Messages
3
Hi,

When I run the macro by F8, it works perfect and the table, corresponsing to the selected cell of the pivot table, opens in a new sheet. However, when done with F5, it gives the runtime error '1004' and the macro terminates with a blank sheet open where cells(1,1) says " retirieving data for (the pivot table name) "

Welcome your thoughts

Regards
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Maybe the below can help you understand better;
The code terminates after the line " wksPivot.Cells(1 + 11, 6).ShowDetail = True "

Regards

Code:
Dim i               As Long
Dim wksPivot        As Worksheet
Dim wksTemp         As Worksheet
Dim varIRR()        As Variant
 

Public Sub Pivot2()
    
    Dim lRow        As Long
    
    Set wksPivot = Worksheets("Pivot")
    
    With wksPivot
        lRow = .Range("f" & .Rows.Count).End(xlUp).Row - 1
    End With
        
    ReDim varIRR(1 To lRow - 11, 1 To 1)
    
    For i = 1 To UBound(varIRR, 1)
       Application.StatusBar = i & "/" & UBound(varIRR, 1) & " Completed"
        
        DoEvents
        wksPivot.Cells(1 + 11, 6).ShowDetail = True
        ShortBreak
 
   Next
    
    
 
End Sub



Sub ShortBreak()
    
    Dim ContinueTime As Date
    
    ContinueTime = Now + TimeValue("00:00:05")
    
    Do While Now() < ContinueTime
        DoEvents
    Loop
 

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,573
Members
452,652
Latest member
eduedu

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