title: Run Macro assigned to a slicer when changing any single value
body: <p>I have a slicer (based on a table), I would like to create a macro in order that when I select any single value in my slicer, the macro selects and copies automatically the second visible cell in column D (for example if I select the value <code>X13</code><a href="https://i.stack.imgur.com/WMZA1.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WMZA1.jpg" alt="enter image description here"></a> in my slicer, I want that my macro selects and copies automatically the second visible cell in column D). The part of my VBA code to select and copy the second visible cell in column D works perfectly but it does not work when I select a single value in my slicer (I assigned the macro related to my slicer). I do not know which line of VBA code that I need to add add for my macro works when I select any single value in my slicer. Please find my VBA code below.</p>
  
  <pre><code>Sub NextVisiblecellassignedtomyslicer()
  Dim r As Range
  Set r = Range("D1")
  For i = 1 To Rows.Count
  Set r = r.Offset(1, 0)
      If r.EntireRow.Hidden = False Then
      r.Copy
      Exit Sub
  End If
  Next
  End Sub
  </code></pre>