+ Reply to Thread
Results 1 to 3 of 3

Count rows in a PivotTable

  1. #1
    Desmond
    Guest

    Count rows in a PivotTable

    I am having trouble of counting the number of rows in PivotTable, I have
    tried to use
    Worksheets("PivotTable").PivotTables("TimePivot").PivotFields("Name").PivotItems.Count,
    but it does not necessarily give the correct answer, any suggestions, thanks
    in advance!

  2. #2
    Debra Dalgleish
    Guest

    Re: Count rows in a PivotTable

    You can count the rows in the tableranges, e.g.:

    Dim pt As PivotTable
    Set pt = Worksheets("PivotTable").PivotTables("TimePivot")
    MsgBox pt.TableRange1.Rows.Count
    MsgBox pt.TableRange2.Rows.Count 'includes page area


    Desmond wrote:
    > I am having trouble of counting the number of rows in PivotTable, I have
    > tried to use
    > Worksheets("PivotTable").PivotTables("TimePivot").PivotFields("Name").PivotItems.Count,
    > but it does not necessarily give the correct answer, any suggestions, thanks
    > in advance!



    --
    Debra Dalgleish
    Excel FAQ, Tips & Book List
    http://www.contextures.com/tiptech.html


  3. #3
    Desmond
    Guest

    Re: Count rows in a PivotTable

    You are a star! Thank you very much!

    "Debra Dalgleish" wrote:

    > You can count the rows in the tableranges, e.g.:
    >
    > Dim pt As PivotTable
    > Set pt = Worksheets("PivotTable").PivotTables("TimePivot")
    > MsgBox pt.TableRange1.Rows.Count
    > MsgBox pt.TableRange2.Rows.Count 'includes page area
    >
    >
    > Desmond wrote:
    > > I am having trouble of counting the number of rows in PivotTable, I have
    > > tried to use
    > > Worksheets("PivotTable").PivotTables("TimePivot").PivotFields("Name").PivotItems.Count,
    > > but it does not necessarily give the correct answer, any suggestions, thanks
    > > in advance!

    >
    >
    > --
    > Debra Dalgleish
    > Excel FAQ, Tips & Book List
    > http://www.contextures.com/tiptech.html
    >
    >


+ 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