+ Reply to Thread
Results 1 to 6 of 6

Macro is grabbing from Pivot table wrong

  1. #1
    Registered User
    Join Date
    04-29-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    92

    Macro is grabbing from Pivot table wrong

    So I have this macro that works wonders! No More pasting and coping every week! The problem is When it gets down to Hospitality Aide, where the first payroll is 3/11/19 it pastes it in the first row of the report which is 1/1/18. How can I fix this? This is the part of the macro that pulls from the pivot table.

    Please Login or Register  to view this content.
    Instead of pasting row 1 I need it to paste via what the headers say.
    Attached Files Attached Files

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Macro is grabbing from Pivot table wrong

    That's because of slicer selection.

    Since Hospitality Aide only has record starting 3/11/2019. That becomes first column visible on pivot.

    You can avoid this by right clicking on Pivot table's column header. Then Field Settings... -> Layout & Print tab -> Check "Show items with no data".
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    04-29-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    92

    Re: Macro is grabbing from Pivot table wrong

    THAT WORKED GREAT THANK YOU!!! such a relief. But not I have one other problem. Now My pivot table under the 2019 year has 1/2/18-12/31/18 Payroll in it but there is nothing there because the data is all in the 2018 year. but it's bringing that over to my report. Which is making the Grand total off. So I have a 2018 Total (at the end of 2018 payrolls), 2019 total (at the end of 2019 payrolls) and I have a Grand Total right after 2019 totals. In Hospitatily aides it puts the grand total in the Second 1/2/18 payroll?

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Macro is grabbing from Pivot table wrong

    Then you'll need additional filter/slicer on pivot table to remove year 2018 I'd imagine.

    Try experimenting with different filters and/or slicers combination to achieve the result you desire.

  5. #5
    Registered User
    Join Date
    04-29-2016
    Location
    USA
    MS-Off Ver
    2013
    Posts
    92

    Re: Macro is grabbing from Pivot table wrong

    it seems the problem is when I select show items with no data, when you subtotal by year it puts 1/2/18-7/15/19 in the 2018 year and 1/2/18-7/15/19 in the 2019 year. With Hospitality aide there is only payroll in the 2019 year so when it does the splicer it only shows 2019 year. Therefore it actually puts it in the first 1/2/18-7/15/19 range which is why its throwing it off. When I choose to show items with no data for the year it puts everything in the right column BUT it has the 2019 in 2018 and 2018 in 2019. If there was a way to hide the duplicates with no data this would work. Is that possible? for 2018 to only show 2018 and 2019 to only show 2019. Or Auto hide those after its done? Which I add a new payroll every two weeks so the hiding columns would change. OR I could just go back and Manually hid in the report after all is done. That would probably be the simplest.

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Macro is grabbing from Pivot table wrong

    I'll try to take a look at your file more in detail a bit later.
    Pivot table by default should not show any duplicate records (it will be aggregated).

+ 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. Replies: 7
    Last Post: 04-19-2015, 12:06 PM
  2. Percentage Formula Wrong and Pivot Table
    By hokkaido19 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-16-2015, 11:41 PM
  3. Pivot table giving wrong results?
    By domgilberto in forum Excel General
    Replies: 1
    Last Post: 10-22-2014, 11:08 AM
  4. Formula grabbing wrong number on second worksheet
    By Smeesters in forum Outlook Formatting & Functions
    Replies: 3
    Last Post: 09-05-2014, 04:15 PM
  5. [SOLVED] Pivot table pulling wrong value
    By RestlessAde in forum Excel General
    Replies: 1
    Last Post: 11-25-2005, 02:35 PM
  6. [SOLVED] Pivot Table Calculated Item-What am I doing wrong?
    By SamBayer1957 in forum Excel General
    Replies: 1
    Last Post: 08-11-2005, 06:05 PM
  7. Grabbing the next column value in a pivot table
    By Alexandre in forum Excel General
    Replies: 1
    Last Post: 06-27-2005, 11:05 AM

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