Atul Vij
Atul Vij

Reputation: 241

select range for Pivot in VBA

I want to create a macro for Pivot table with dynamic range. Pivot table is already made , I am just want to make Dynamic range selection macro. Range is A2:L Please help Me how to create macro for just range selection and refresh All.

Sum of Amount in Document Currency      Document Currency   
Company Code    Trading Partner   BGN     EUR
BG05               CH10       272,326.08    1,618.00
HS03               RS31      1,618.00

Upvotes: 1

Views: 975

Answers (1)

Atul Vij
Atul Vij

Reputation: 241

Below code is Woking for me. Got resolution.

Sub ChangeCaches()
Dim PT As PivotTable
Set PT = Sheets("OPEN ITEMS DETAIL").PivotTables("PivotTable1")
PT.SourceData = Sheets("Download").Range("A1").CurrentRegion.Address(True, True, xlR1C1, True)
End Sub

Upvotes: 1

Related Questions