+ Reply to Thread
Results 1 to 7 of 7

Macro to show pivot table details..Any ideas?

Hybrid View

  1. #1
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Macro to show pivot table details..Any ideas?

    I'm not quite sure where to begin but first to resolve your issue (I hope) you need to change the below section:

    Dim wsPT As Worksheet
    On Error GoTo Handler:
    Set wsPT = Sheets("billing")
    wsPT.Cells(Application.Match("Grand Total", wsPT.Columns(1), 0), "C").ShowDetail = True
    ExitPoint:
    Set wsPT = Nothing
    
    
    Handler:
    MsgBox "Error Has Occurred etc...", vbCritical, "Routine Terminated"
    Resume ExitPoint
    
        
    
     
        
    Exit Sub
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    
    
    
    End Sub
    To something more along the lines of:

    Dim wsPT As Worksheet
    On Error GoTo Handler:
    Set wsPT = Sheets("billing")
    wsPT.Cells(Application.Match("Grand Total", wsPT.Columns(1), 0), "C").ShowDetail = True
    ExitPoint:
    Set wsPT = Nothing
    Application.EnableEvents = True
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
    Exit Sub
    
    Handler:
    MsgBox "Error Has Occurred etc...", vbCritical, "Routine Terminated"
    Resume ExitPoint
    
    End Sub
    As it is you're going into the error handler as part of the routine and thus a perpetual loop... also as above you should be resetting your App settings to TRUE not FALSE ... Events unlike ScreenUpdating will not reset to True by default and is pretty much guaranteed to cause you major headaches.

  2. #2
    Registered User
    Join Date
    02-18-2009
    Location
    Ontario
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Macro to show pivot table details..Any ideas?

    That works perfectly.


    Thanks for your help.

    Greg

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1