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:
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
Bookmarks