Member413043
New Member
- Joined
- Feb 3, 2021
- Messages
- 2
- Office Version
- 2019
- Platform
- Windows
Hello,
Is it possible to pass a pivot table variable as a parameter to a subroutine, similar to below? When I attempt the following, I get a Compile error: Type mismatch.
Sub testMain()
Dim ptApples As PivotTable
Set ptApples = ThisWorkbook.Worksheets("apples").PivotTables("ptApples")
testExtension (ptApples)
End Sub
Sub testExtension(ptContainer As PivotTable)
ptContainer.PivotFields("Order").DataRange.Select
End Sub
Is it possible to pass a pivot table variable as a parameter to a subroutine, similar to below? When I attempt the following, I get a Compile error: Type mismatch.
Sub testMain()
Dim ptApples As PivotTable
Set ptApples = ThisWorkbook.Worksheets("apples").PivotTables("ptApples")
testExtension (ptApples)
End Sub
Sub testExtension(ptContainer As PivotTable)
ptContainer.PivotFields("Order").DataRange.Select
End Sub