+ Reply to Thread
Results 1 to 8 of 8

Automated Pivot Generation

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Automated Pivot Generation

    Hello everyone. I have code written which generates pivot tables. Please see a snipett of the code below:

    Please Login or Register  to view this content.
    Now here is the deal, rather than have hard coded dates as in

    Please Login or Register  to view this content.
    I would like to pass a global variable fDate? Any suggestions on how to go about this.
    Last edited by AnthonyWB; 06-03-2010 at 11:37 AM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,003

    Re: Automated Pivot Generation

    For example:
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Automated Pivot Generation

    Do I declare strDate globally AsString, or within the sub ?


    Please Login or Register  to view this content.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,003

    Re: Automated Pivot Generation

    Within the sub. Public variables should be avoided if possible - always give variables the least scope they need.

  5. #5
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Automated Pivot Generation

    I declared the variable locally, however I now have an error that cropps up

    Compile Error: Sub or Function Not Defined

    Please Login or Register  to view this content.
    The AddDataField is highlighted in yellow.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,003

    Re: Automated Pivot Generation

    There should be a period in front of it :
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Automated Pivot Generation

    Sorry should be .Add

  8. #8
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2007
    Posts
    458

    Re: Automated Pivot Generation

    Yep it runs, thanks.

+ 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