Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =GETPIVOTDATA("Sum of MyField",B9,"This",Table1[@This])
- Option Explicit
- Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
- If Target.Name = "PivotTable1" Then
- Dim wb As Workbook
- Dim ws As Worksheet
- Dim pvt As PivotTable
- Dim numberOfPivotRows
- Dim targetColumn As Range
- Set wb = ThisWorkbook
- Set ws = wb.Worksheets("Sheet1")
- Set pvt = Target
- numberOfPivotRows = pvt.DataBodyRange.Rows.Count
- Set targetColumn = ws.Range("Table2[Column1]") 'put the correct sheet name, table name and target column where you want to write your values to
- If targetColumn.Rows.Count < numberOfPivotRows Then
- With targetColumn
- .Resize(numberOfPivotRows, 1).FillDown
- End With
- End If
- End If
- End Sub
Add Comment
Please, Sign In to add comment