title: Simplify repetitive VBA hiding row code for Excel
body: <p>I'm very new to VBA so please bare with me.</p>
  <p>I am looking at a way of simplifying the following code I have used to hide cells based on a certain cell value.</p>
  <p>Here is a section of it, however it goes on right up until row 202 on one sheet (more on other sheets).</p>
  <p>Whilst this code gives the desired result, it becomes very slow the more that is added.</p>
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
      If Range(&quot;AD31&quot;).Value = &quot;Yes&quot; Then
          Rows(&quot;32:39&quot;).EntireRow.Hidden = False
      ElseIf Range(&quot;AD31&quot;).Value = &quot;No&quot; Then
          Rows(&quot;32:39&quot;).EntireRow.Hidden = True
      End If
      If Range(&quot;AD40&quot;).Value = &quot;Yes&quot; Then
          Rows(&quot;41:48&quot;).EntireRow.Hidden = False
      ElseIf Range(&quot;AD40&quot;).Value = &quot;No&quot; Then
          Rows(&quot;41:48&quot;).EntireRow.Hidden = True
      End If
      If Range(&quot;AD49&quot;).Value = &quot;Yes&quot; Then
          Rows(&quot;50:57&quot;).EntireRow.Hidden = False
      ElseIf Range(&quot;AD49&quot;).Value = &quot;No&quot; Then
          Rows(&quot;50:57&quot;).EntireRow.Hidden = True
      End If
      If Range(&quot;AD58&quot;).Value = &quot;Yes&quot; Then
          Rows(&quot;59:66&quot;).EntireRow.Hidden = False
      ElseIf Range(&quot;AD49&quot;).Value = &quot;No&quot; Then
          Rows(&quot;59:66&quot;).EntireRow.Hidden = True
      End If
  </code></pre>
  <p>...and so on</p>
  <p>Thanks</p>