Pivot Range

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
Hi All,
In the red highlighted, how do place Range(A:AC)
Code:
ActiveSheet.PivotTables("PivotTable2").ChangePivotCache ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"\\serverpath\[ANALYSIS.xlsx]Details![COLOR=#ff0000]R1C1:R3C32[/COLOR]", Version:=xlPivotTableVersion14)
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Don't. You do not want to include all 1.2 Mil rows of data, even if blank.
You will be better served converting that range to a Table (CTRL+T) and then creating a Pivot Table.
Use the macro recorder to get the syntax for using a Table in the macro.
 
Upvote 0
Any idea on this
Code:
'For Pivot Refresh
Dim Tbl As Range
Tbl = Range("A2", Range("AB2").End(xlDown)).Select
 
Upvote 0
Hi All,
instead of starting new query...can any one genuinely guide how I can give editable range every time in pivot code...
 
Upvote 0
So nice of you and really cool for this reply..

But, also help me, how do i write a code for this..How this name i can place in code..:diablo:.. :):)

Go for a CurrentRegion
Example:
Code:
Set TabRange = Range("A3").CurrentRegion
 
Upvote 0
I copied my use directly, but it would essentially replace yours as
Code:
Dim Tbl as Range
' Getting the actual range assigned to the Rang object
Set Tbl= Range("A3").CurrentRegion
' Then I make that range available to the name manger.
ActiveSheet.ListObjects.Add(xlSrcRange, TabRange, , xlYes).Name _
    = "Open_Acct_Balances"
' I then begin the Pivot Table Cache using the Named Range that has been added
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "[B]Open_Acct_Balances[/B]", Version:=xlPivotTableVersion15).CreatePivotTable _
        TableDestination:="Sheet1!R1C1", TableName:="APPO_Acrual_PT", DefaultVersion _
        :=xlPivotTableVersion15
Its not the same as using proper Table methodology, but in my case it wasn't needed. This macro runs as a one-and-done situation and there are no updates to the data in the Workbook.
I also wrote this before I was into the PowerQuery methodologies. Thankfully that is open to all Excel 2016 users, but also disappointed knowing there are many on 2013 or earlier:evil:
 
Upvote 0
I like and happy to see your reply. But have a question here, what is "Open_Acct_Balances" in code..
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top