+ Reply to Thread
Results 1 to 7 of 7

Pivot Table Macro Needed

  1. #1
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Pivot Table Macro Needed

    Hi

    I have a couple of pieces of code from other macros and I want to combine them to make one piece of code if possible.

    I want to create a pivot table in a new worksheet using the data in the Sheet Report1.

    The data starts in A2 and goes across to Q2 and the end of the data varies.

    I have this which will count the rows in column A.

    Please Login or Register  to view this content.
    I have then amended that to take off the header and sum columns.

    Please Login or Register  to view this content.
    Then I have this to select the range.

    Please Login or Register  to view this content.

    I want to put this in here but don't know how to.

    Please Login or Register  to view this content.

    Basically getting rid of the hard coding of the range in the pivot table part.

    Any help much appreciated.

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

    Re: Pivot Table Macro Needed

    Do you mean your headers are in row 2 on the data sheet? Why are you subtracting 2 and not 1 from the last row variable?
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Re: Pivot Table Macro Needed

    My headers are in row 1 and the total for the sheet is in the very last row which is variable. So I thought I needed to take off 2.

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

    Re: Pivot Table Macro Needed

    Nope - you need to include headers for the pivot table to use as field names. So:

    Please Login or Register  to view this content.
    Note I changed the C18 to C17 since you said column Q, not R.

  5. #5
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Re: Pivot Table Macro Needed

    Hi romperstomper,

    This works almost perfectly. How can i make the pivot table start in A1 of the new sheet? It is spread across C:G.

    Regards

    Tim

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

    Re: Pivot Table Macro Needed

    You need to change this bit:
    Please Login or Register  to view this content.
    You can switch it to:
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Re: Pivot Table Macro Needed

    Brilliant, many thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. complex macro needed for pivot table
    By Exceler54 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-08-2014, 01:18 PM
  2. Macro Help Needed - Link Pivot Table Filter to Regular Table AutoFilter
    By ycx1129 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-11-2011, 12:54 PM
  3. Macro needed for pivot table
    By PlanetGong in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2009, 05:55 PM
  4. Help needed with Pivot table macro to remove data
    By Nelly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2006, 09:00 PM
  5. [SOLVED] Macro Needed for Pivot Table
    By douglascfast@hotmail.com in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-12-2005, 12:10 PM

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