Results 1 to 2 of 2

macro needed to generate pivot table with exact format

Threaded View

  1. #1
    Registered User
    Join Date
    10-16-2012
    Location
    Dallas, tx
    MS-Off Ver
    Excel 2003
    Posts
    67

    macro needed to generate pivot table with exact format

    On the attached file, detail tab information update constantly. i like to have a macro to do followings:

    1. Generate pivot table in the new tab
    2. table format is same each time, Project under col labels, Accoutn and desc under Row labels, and sum of total for value
    3. I like to format the number like 1,500.00 or (1,500.00) if it is negative
    4. do not show subtotals
    5. freeze panel at corner of project and desc like shown on the

    or could it be easier if i can just keep the pivot there, and just update detail tab, having code in the pivot tab to automatically capture all the added/del rows and do auto refresh each time.

    I think i figure out the code ,which i put on the detail sheet, but haven't tried yet, anyone think there is something wrong, let me know. basically it should work when i update the detail tab, pivot automatically refresh.

    Formula: copy to clipboard
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rng As Range
    Set rng = Range("A1").CurrentRegion
    Set rng = rng.Resize(rng.Rows.Count + 1, rng.Columns.Count + 1)
    If Not Intersect(rng, Target) Is Nothing Then
    Worksheets("Pivot").PivotTables(1).PivotCache.Refresh
    End If
    End Sub


    somehow this code only works when i delete rows, but when add new rows, doesn't do anything
    Attached Files Attached Files
    Last edited by turbo600hp; 02-27-2013 at 12:09 AM.

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