title: Expanding specific sections of a pivot table in Excel via VBA and/or jumping to original spot
body: <blockquote>
  <p>I have a pivot table segmented by years, quarters and months. If I try
  to expand a quarter for 2015, however, the corresponding quarter in
  all other years are shown as well. How can I expand only one quarter
  for one year?
  <br />- <a href="https://superuser.com/questions/1049881/expanding-specific-sections-of-a-pivot-table-in-excel">https://superuser.com/questions/1049881/expanding-specific-sections-of-a-pivot-table-in-excel</a></p>
  </blockquote>
  <p>This question got no answer there, but that wasn't a programming forum. I have a similar question. Is there a VBA solution?</p>
  <p>Alternatively, is there a VBA code to &quot;catch&quot; expansion clicks and then jump into the original cell on which plus was clicked?</p>
  <p><a href="https://i.stack.imgur.com/WX6Ua.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WX6Ua.png" alt="Years and months" /></a></p>
  <p>Sample code (I want this true just for <em>2016</em>):</p>
  <pre><code>ActiveSheet.PivotTables(1).PivotFields(&quot;Month&quot;).PivotItems(&quot;3&quot;).ShowDetail = True
  </code></pre>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Year</th>
  <th>Month</th>
  <th>Text</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>2015</td>
  <td>1</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2015</td>
  <td>2</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2015</td>
  <td>3</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2015</td>
  <td>4</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2015</td>
  <td>5</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2016</td>
  <td>1</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2016</td>
  <td>2</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2016</td>
  <td>3</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2016</td>
  <td>4</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2016</td>
  <td>5</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2017</td>
  <td>1</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2017</td>
  <td>2</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2017</td>
  <td>3</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2017</td>
  <td>4</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2017</td>
  <td>5</td>
  <td>Dummy1</td>
  </tr>
  <tr>
  <td>2015</td>
  <td>1</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2015</td>
  <td>2</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2015</td>
  <td>3</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2015</td>
  <td>4</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2015</td>
  <td>5</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2016</td>
  <td>1</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2016</td>
  <td>2</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2016</td>
  <td>3</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2016</td>
  <td>4</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2016</td>
  <td>5</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2017</td>
  <td>1</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2017</td>
  <td>2</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2017</td>
  <td>3</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2017</td>
  <td>4</td>
  <td>Dummy2</td>
  </tr>
  <tr>
  <td>2017</td>
  <td>5</td>
  <td>Dummy2</td>
  </tr>
  </tbody>
  </table>
  </div>