Table Destination (Pivot Table) VBA

jaszz

New Member
Joined
Mar 25, 2019
Messages
5
My pivot table doesn't have a specific cell as its table destination as it will depend on the last used cell. If my last used cell is G1, the table destination of the pivot table should be I1.

Please help. I've been searching through the internet for over 5 hours now and I couldn't find anything.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
What about
Code:
[LEFT][COLOR=#222222][FONT=Verdana]Dim Source As Range
Set Source = [COLOR=#FF0000]Sheet1[/COLOR].Range("A1:C8")
Dim Dest As Range
Set Dest =[COLOR=#FF0000] [/COLOR][COLOR=#FF0000]Sheet1[/COLOR].UsedRange.SpecialCells(xlCellTypeLastCell).Offset(0, 2)


[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        Source, Version:=6).CreatePivotTable TableDestination:= _
        Dest, TableName:="PivotTable1", DefaultVersion:=6[/FONT][/COLOR][/LEFT]

?
 
Upvote 0
What about
Code:
[LEFT][COLOR=#222222][FONT=Verdana]Dim Source As Range
Set Source = [COLOR=#FF0000]Sheet1[/COLOR].Range("A1:C8")
Dim Dest As Range
Set Dest =[COLOR=#FF0000]Sheet1[/COLOR].UsedRange.SpecialCells(xlCellTypeLastCell).Offset(0, 2)


[/FONT][/COLOR]
[COLOR=#222222][FONT=Verdana]    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        Source, Version:=6).CreatePivotTable TableDestination:= _
        Dest, TableName:="PivotTable1", DefaultVersion:=6[/FONT][/COLOR][/LEFT]

?


This is what I currently have:

Code:
    'move down thrice    ActiveCell.End(xlDown).Select
    ActiveCell.Offset(3).Select
    ActiveCell.Offset(1).Select


Sheets("Raw DUMP").Select    Range("A1:P1").Select
    LastRow = Cells(Rows.Count, 1).End(xlUp).Row
    Range("A1:P" & LastRow).Select
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "Raw DUMP!R1C1:R1349C16", Version:=6).CreatePivotTable _
        TableDestination:=ActiveCell, TableName:="PivotTable5", _
        DefaultVersion:=6



Sorry I need to do the move down first.
 
Upvote 0

Forum statistics

Threads
1,223,905
Messages
6,175,297
Members
452,633
Latest member
DougMo

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