Good morning,
I'm pretty unfamiliar with coding any VBA at all, but I do well enough reading it.
I'm trying to unselect all filtered values from PivotTable "PivotTable1" PivotFields "CUSNO", then select 2 values that would be in the list of values based on if they exist or not. There's generally anywhere from 40-200 different values listed in the filter that change dynamically day to day. Also, both values I want to have selected sometimes both show up or often times one or the other and not both.
I have a column on a separate worksheet that is refreshed and updated that represents every value that currently exists in the "CUSNO" PivotField. The source data for "CUSNO" PivotField.
On the same worksheet as the Pivot Table, I have the below two cells that check on if that column contains either value I'm looking for.
In cell G1, I check if value "87456" exists in that column. If it does, G1 = 1, if it does not then G1 = 0.
In cell G2, I check if value "87454" exists in that column. If it does, G2 = 1, if it does not then G2 = 0.
I'm hoping to gather VBA code that does this:
IF(AND(G1=1,G2=1), Run VBA that unselects all CUSNO PivotField values and then selects only values "87456" and "87454"
IF(AND(G1=1,G2=0), Run VBA that unselects all CUSNO PivotField values and then selects only value "87456"
IF(AND(G1=0,G2=1), Run VBA that unselects all CUSNO PivotField values and then selects only value "87454"
IF(AND(G1=0,G2=0), well, do nothing then.
Thank you for any possible help on this. It's greatly appreciated!
I'm pretty unfamiliar with coding any VBA at all, but I do well enough reading it.
I'm trying to unselect all filtered values from PivotTable "PivotTable1" PivotFields "CUSNO", then select 2 values that would be in the list of values based on if they exist or not. There's generally anywhere from 40-200 different values listed in the filter that change dynamically day to day. Also, both values I want to have selected sometimes both show up or often times one or the other and not both.
I have a column on a separate worksheet that is refreshed and updated that represents every value that currently exists in the "CUSNO" PivotField. The source data for "CUSNO" PivotField.
On the same worksheet as the Pivot Table, I have the below two cells that check on if that column contains either value I'm looking for.
In cell G1, I check if value "87456" exists in that column. If it does, G1 = 1, if it does not then G1 = 0.
In cell G2, I check if value "87454" exists in that column. If it does, G2 = 1, if it does not then G2 = 0.
I'm hoping to gather VBA code that does this:
IF(AND(G1=1,G2=1), Run VBA that unselects all CUSNO PivotField values and then selects only values "87456" and "87454"
IF(AND(G1=1,G2=0), Run VBA that unselects all CUSNO PivotField values and then selects only value "87456"
IF(AND(G1=0,G2=1), Run VBA that unselects all CUSNO PivotField values and then selects only value "87454"
IF(AND(G1=0,G2=0), well, do nothing then.
Thank you for any possible help on this. It's greatly appreciated!