Results 1 to 2 of 2

Retain pivot table data every time I refresh it?

Threaded View

  1. #1
    Registered User
    Join Date
    10-23-2014
    Location
    USA
    MS-Off Ver
    2010
    Posts
    1

    Retain pivot table data every time I refresh it?

    Hi everyone,

    I have made a pivot table which summarises the number of accounts in different sheets and the dollar value of each sheet.

    However, the number of accounts on each sheet (and therefore dollar values) will change on a daily basis, so I 'refresh' my pivot table at the end of each day. But this only gives me the new values and does not retain the values that were there before.

    Are there any macros available that would copy a set of the original pivot table data each time I click refresh, so that by the end of the week (for example) I have a set of data for each day? The historical data can just be copied alongside my pivot table.


    Currently I use this code-- A1:D23 is my actual range. However, with this code I need to manually copy the previous day's data from G1:J23 to K1:N23 so that today's data can be copied to G1:J23 and this manual copy/pasting is time-consuming as I've got a lot of pivot tables, one for each department.

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Range("A1:D23")) Is Nothing Then
            Application.EnableEvents = False
            Range("K1:N23").Copy Range("G1:J23")    'On Deck becomes Prior Data
            Range("A1:D23").Copy Range("G1:J23")      'New data copied to On Deck area
            Application.EnableEvents = True
        End If
    End Sub
    I am quite new to VBA, so any help is greatly appreciated. Thank you
    Last edited by Richard Buttrey; 10-24-2014 at 07:34 PM. Reason: code tags missing

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 02-23-2024, 02:11 PM
  2. Replies: 0
    Last Post: 08-14-2013, 06:31 AM
  3. Run time error 1004. Pivot Table Refresh
    By mlegge77 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-02-2013, 11:26 AM
  4. PProtect a sheet containing a pivot table but allow table to refresh data?
    By ThomasCarter in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-22-2013, 05:46 AM
  5. import data from access table to excel pivot table - Enable Auto Refresh
    By okl in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-01-2010, 09:38 AM

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