0

My VBA doesn't work with more than the first parameter. Here is my sub header: Sub filterPivotTables(ParamArray argumentsArray() As Variant , sheetName As String,pivotTableName As String,pivotField As String)

However, when I change the sub header to this: Sub filterPivotTables(ParamArray argumentsArray() As Variant) it works.

Is there a reason why I can’t pass in more than one parameter? How would you pass in more than one parameter? Thanks

1
  • How/Why doesn't it work? Commented Jun 2, 2020 at 1:07

1 Answer 1

2

ParamArray must be the last argument in the procedure declaration:

Sub filterPivotTables(sheetName As String, pivotTableName As String, pivotField As String, ParamArray argumentsArray() As Variant)

See the docs for a more thorough discussion of ParamArray.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.