Microsoft Excel
#1
Pivot Tables.
Does anyone know how to select the whole pivot table in VBA.
I want a macro that creates a pivot table then copies it, but I'm having real problems selecting the whole thing.
Anyone?????
Does anyone know how to select the whole pivot table in VBA.
I want a macro that creates a pivot table then copies it, but I'm having real problems selecting the whole thing.
Anyone?????
#3
nope, doesn't like it,
this is what I have so far -
Dim mypivot As PivotTable
Dim myfield As PivotField
Dim myitem As PivotItem
Dim myrange As Range
Set mypivot = ActiveSheet.PivotTableWizard
Set myfield = mypivot.PivotFields("T1-Gross-Qty")
myfield.Orientation = xlDataField
Set myfield = mypivot.PivotFields("ISBN")
myfield.Orientation = xlRowField
mypivot.AddFields "ISBN", "Rep-Area"
****now in here I want to select the whole table*****
this is what I have so far -
Dim mypivot As PivotTable
Dim myfield As PivotField
Dim myitem As PivotItem
Dim myrange As Range
Set mypivot = ActiveSheet.PivotTableWizard
Set myfield = mypivot.PivotFields("T1-Gross-Qty")
myfield.Orientation = xlDataField
Set myfield = mypivot.PivotFields("ISBN")
myfield.Orientation = xlRowField
mypivot.AddFields "ISBN", "Rep-Area"
****now in here I want to select the whole table*****
#5
Range("range of pivot table").Select
Selection.Copy
Range("top left corner of where you want to put it").Select
ActiveSheet.Paste
Just tried this and it works for me. Also updates new table on a refresh, so it is actually copying the table and not simply the contents
Selection.Copy
Range("top left corner of where you want to put it").Select
ActiveSheet.Paste
Just tried this and it works for me. Also updates new table on a refresh, so it is actually copying the table and not simply the contents
#7
cheers Martin.
FB, the problem with selecting the range is the pivot tables in this macro are all different sizes and when new ones are created are different sizes again, meaning I couldn't just selct a range.
Cheers guys
FB, the problem with selecting the range is the pivot tables in this macro are all different sizes and when new ones are created are different sizes again, meaning I couldn't just selct a range.
Cheers guys
Trending Topics
Thread
Thread Starter
Forum
Replies
Last Post
Mattybr5@MB Developments
Full Cars Breaking For Spares
28
28 December 2015 11:07 PM
Mattybr5@MB Developments
Full Cars Breaking For Spares
12
18 November 2015 07:03 AM
bluebullet29
General Technical
9
05 October 2015 02:17 PM