Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

how use if then

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

ResolvedVersion 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:

Difference between Two Dates

The DATEDIF function computes the difference between two dates. The DATEDIF function is as follows:

=DATEDIF (Date1,Date2,Interval)

Please note that Date1 must be less than (earlier) or equal to Date2

Please note that Interval must be one of the following codes: "d" (in days), "m" (in months), "y" (in years) expressed in quotes


View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.