stephenedger
New Member
- Joined
- Jul 4, 2014
- Messages
- 20
Hi,
I am using Excel 2010, and have a basic understanding if VBA.
I have found a piece of code that allows me to set my print range to just print the pivot table on the page, which works fine.
With ActiveSheet
.PageSetup.PrintArea = .PivotTables(1).TableRange2.Address
End With
However, I also want it to print the range A1:V12, which is directly above the Pivot table (the range includes a table providing high-level figures). I have scoured the web, but can't seem to solve it. I tried the following but it gave me a compile error.
Dim rngTable As Range
Dim rngPivot As Range
Set rngTable = Range("$A$1:$V$12")
Set rngPivot = Range("PivotTable1")
With ActiveSheet
.PageSetup.PrintArea = Union(rngTable, rngPivot).Address
End With
Any help would be gratefully appreciated.
Regards,
Stephen
I am using Excel 2010, and have a basic understanding if VBA.
I have found a piece of code that allows me to set my print range to just print the pivot table on the page, which works fine.
With ActiveSheet
.PageSetup.PrintArea = .PivotTables(1).TableRange2.Address
End With
However, I also want it to print the range A1:V12, which is directly above the Pivot table (the range includes a table providing high-level figures). I have scoured the web, but can't seem to solve it. I tried the following but it gave me a compile error.
Dim rngTable As Range
Dim rngPivot As Range
Set rngTable = Range("$A$1:$V$12")
Set rngPivot = Range("PivotTable1")
With ActiveSheet
.PageSetup.PrintArea = Union(rngTable, rngPivot).Address
End With
Any help would be gratefully appreciated.
Regards,
Stephen