how use if then
RH

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » How to use an if then with pivot table

How to use an if then with pivot table

resolvedResolved · Urgent Priority · Version 2007

Tony has attended:
Excel VBA Advanced course

How to use an if then with pivot table

Hi,

This relates to a previous query but I though I would send a new query to make my request clearer.

I am trying to change a pivot table to show either "Sainsbury" or "(blank)" depending on the outcome of a search in a particular range.
I have some of the code but not enough to make it work. Here is where I am so far

IF my search finds "Sainbury" in a range D1:D100 (what is the code for this?)
THEN (is this right?)
ActiveSheet.PivotTables("PivotTable3").PivotFields("Name"). _
CurrentPage = "Sainsbury"
ELSE (is this right?)
ActiveSheet.PivotTables("PivotTable3").PivotFields("Name"). _
CurrentPage = "(blank)"

What is the complete code required to make this work? If the above is not clear enough then please let me know if it is easier to call to explain.

Thanks
Tony

RE: How to use an if then with pivot table

Hi Tony

Thanks for your post and detail. We may be able to help but it does take us beyond the scope of this forum.

We would need to see your actual files and if a solution can be reached we will advise on development time required and associated costs.

If you would like to look into this further please reply to me.

Kind regards

Jacob

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Finding cells that have data restrictions

Click anywhere on the worksheet.
On the Edit menu, click Go To.
Click Special.
Click Data validation.
Click All.

View all Excel hints and tips


Server loaded in 0.05 secs.