Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jan 2001
    Location
    Arlington, Virginia, USA
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pivot Table Update in VBA (Excel 97/00)

    I want to cause a pivot table to update from within VBA code. Does anyone out there have an example ofthe coding?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Pivot Table Update in VBA (Excel 97/00)

    The following line of code should help<pre> Sheets("SheetName").PivotTables("PivotTableName"). RefreshTable</pre>

    where SheetName is the name of the sheet containg the PT, and PivotTableName is the name of thePivot Table.

    Andrew C

  3. #3
    New Lounger
    Join Date
    Jan 2001
    Location
    Arlington, Virginia, USA
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Pivot Table Update in VBA (Excel 97/00)

    Andrew,

    Thanks, works great. Now I need to make the columns adjust to the new number so I don't get ##### across the cell.

    Dean

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Pivot Table Update in VBA (Excel 97/00)

    Dean,

    See if this works better<pre> With Sheets("SheetName").PivotTables("PivotTableName")
    .RefreshTable
    .PivotSelect "", xlDataOnly
    Selection.Columns.AutoFit
    End With</pre>


    Andrew C

Posting Permissions

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