+ Reply to Thread
Results 1 to 2 of 2

Updating Page Field of Pivot Tables from Form Control

  1. #1
    RestlessAde
    Guest

    Updating Page Field of Pivot Tables from Form Control

    Hi,

    I would like to use a pull down menu to feed into a pivot table page field.
    So for example, when I select employee name in the pull down menu of the
    form, that employee name is used as the page field value for a pivot table.

    I'm assuming this needs to be done in VB, but can't work out how. Any advice
    would be much appreciated

    Thanks,
    Ra

  2. #2
    William Horton
    Guest

    RE: Updating Page Field of Pivot Tables from Form Control

    This is very raw but it works.

    Sub PivotTable()
    ActiveSheet.PivotTables("PivotTable2").PivotFields("Name").CurrentPage =
    ActiveSheet.Range("A8").Value
    End Sub

    This assumes you are running macro from the activesheet and that the data
    and pivot table are on the same sheet. If not please adjust code. It also
    assumes that "Name" is the page field title you are using. Lastly it assumes
    that the pull down menu value in the form is located in cell A8. Please
    adjust as necessary. With that said when this macro runs it will change the
    page field Name to whatever is in cell A8. You may want to add this code
    along with other code to the change event of the worksheet that contains your
    form. That way you can program it so that the pivot table changes/refreshes
    automatically whenever the drop down value in the form is changed.

    Hope this gets you started.

    Thanks,
    Bill Horton

    "RestlessAde" wrote:

    > Hi,
    >
    > I would like to use a pull down menu to feed into a pivot table page field.
    > So for example, when I select employee name in the pull down menu of the
    > form, that employee name is used as the page field value for a pivot table.
    >
    > I'm assuming this needs to be done in VB, but can't work out how. Any advice
    > would be much appreciated
    >
    > Thanks,
    > Ra


+ 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