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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Kamolga

Well-known Member
Joined
Jan 28, 2015
Messages
1,180
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]

?
 

jaszz

New Member
Joined
Mar 25, 2019
Messages
5
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,487
Messages
5,831,982
Members
430,100
Latest member
namhnz

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
Top