+ Reply to Thread
Results 1 to 2 of 2

Pivot Table Question

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-13-2004
    Posts
    120

    Pivot Table Question

    I think this might be better suited to be posted here instead of the charting forum.

    --------------------------------------------------------------------------------

    I have a userform, and it has 2 textboxes, is there a way that I can write a macro that will only display that data on a pivot table between the 2 dates entered in these textboxes?

    Right now I have the below, but I don't want to have to have all the dates written like this.

    With thisworkbook.sheets("CARS Survey Results by Date").PivotTables("PivotTable2").PivotFields("Date")
    .PivotItems("9/28/2005").Visible = True
    .PivotItems("9/29/2005").Visible = True
    .PivotItems("9/30/2005").Visible = True
    End With

    I would like to enter "9/28/2005" in textbox1 & "9/30/2005" in textbox 2 and have it display only these results.

    Any help will be greatly appreciated.

  2. #2
    Jim Thomlinson
    Guest

    RE: Pivot Table Question

    The easiest way to do something like that is to have the two text boxes
    populate two cells on on your spreadsheet somewhere. Add a column to your
    spreadsheet called included dates (or something like that) and then have a
    formula in this column that returns a true (if the date is between the two
    dates) or false based on the two dates. Include this field at the top of the
    pivot table and then just refresh it. The solution seems a little Mickey
    Mouse but it is easy and it works quite well.
    --
    HTH...

    Jim Thomlinson


    "dok112" wrote:

    >
    > I think this might be better suited to be posted here instead of the
    > charting forum.
    >
    > --------------------------------------------------------------------------------
    >
    > I have a userform, and it has 2 textboxes, is there a way that I can
    > write a macro that will only display that data on a pivot table between
    > the 2 dates entered in these textboxes?
    >
    > Right now I have the below, but I don't want to have to have all the
    > dates written like this.
    >
    > With thisworkbook.sheets("CARS Survey Results by
    > Date").PivotTables("PivotTable2").PivotFields("Date")
    > .PivotItems("9/28/2005").Visible = True
    > .PivotItems("9/29/2005").Visible = True
    > .PivotItems("9/30/2005").Visible = True
    > End With
    >
    > I would like to enter "9/28/2005" in textbox1 & "9/30/2005" in textbox
    > 2 and have it display only these results.
    >
    > Any help will be greatly appreciated.
    >
    >
    > --
    > dok112
    > ------------------------------------------------------------------------
    > dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581
    > View this thread: http://www.excelforum.com/showthread...hreadid=478854
    >
    >


+ 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