+ Reply to Thread
Results 1 to 1 of 1

Prevent data source range for pivots from changing

  1. #1
    Registered User
    Join Date
    01-27-2021
    Location
    atlanta
    MS-Off Ver
    365 (Enterprise)
    Posts
    24

    Prevent data source range for pivots from changing

    I've made a macro for my team that basically inserts columns, does some calculations, and delete rows. It runs fine but the last step I want to include is refresh the pivot tables that are sourced to these data ranges. But every single time the data source range keeps changing and it makes the pivots error. For example, if my starting data is from A:N, and the macro adds columns to make it A:P, the pivot table source will suddenly change to A:S

    I tried doing the named ranges with absolute ranges $A:$P and it still doesn't work. Using the offset formula to make a dynamic range doesn't seem to work either - in fact the offset formula kept changing to completely different columns so I stopped trying.


    I think Excel is getting confused when a bunch of column changes are happening before refreshing. Is there any code to lock a data source range regardless of what happens in the macro? I’ve attached a sample workbook with my macro. I want the data to stay as A:P for the QV Pivot and A:U for the WHSE pivot. The code isn’t the cleanest but I have comments in what I’m expecting it to do. Any help or suggestions is appreciated
    Attached Files Attached Files
    Last edited by beginner21; 02-24-2022 at 09:59 AM. Reason: more clear attachment

+ 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. Changing column name in source data for pivots
    By rishalb85 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-07-2021, 12:07 PM
  2. Replies: 0
    Last Post: 10-18-2013, 11:35 AM
  3. [SOLVED] Refresh data from web and prevent VLOOKUP range from changing
    By nobodyukno in forum Excel General
    Replies: 8
    Last Post: 08-17-2013, 04:56 PM
  4. Dynamic range with changing worksheet as data source
    By JuJuBe in forum Excel General
    Replies: 0
    Last Post: 11-15-2011, 05:15 PM
  5. Replies: 0
    Last Post: 11-03-2009, 10:22 AM
  6. Same Data source for Multiple Pivots
    By anandmr65 in forum Excel General
    Replies: 3
    Last Post: 07-07-2006, 07:47 AM
  7. Anyone help with this error in changing data source of pivots
    By Job in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2005, 06:20 PM

Tags for this Thread

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