Results 1 to 2 of 2

How to determine if filtered pivot table is empty

This is a discussion on How to determine if filtered pivot table is empty within the Excel Questions forums, part of the Question Forums category; How to determine if filtered pivot table is empty by using vba ....

  1. #1
    New Member
    Join Date
    Sep 2015
    Posts
    24

    Default How to determine if filtered pivot table is empty

    How to determine if filtered pivot table is empty by using vba.

  2. #2
    Board Regular
    Join Date
    Jan 2014
    Posts
    472

    Default Re: How to determine if filtered pivot table is empty

    You could count the cells within the dataset
    Code:
    Sub test()
    Dim pt As PivotTable
    Set pt = ActiveSheet.PivotTables(1)
     
    MsgBox (pt.DataBodyRange.Count > 0)
    End Sub
    This would have to be slightly different if you had grandtotals

    Here's some examples of referencing different pivot ranges:
    Referencing Pivot Table Ranges in VBA - Peltier Tech Blog
    Referencing an Excel Pivot Table Range using VBA
    Last edited by ghrain22; Apr 8th, 2016 at 10:34 AM.

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com