title: Excel VBA to hide and unhide columns based on a dropdown validation list selection
body: <p>I have a dropdown validation list in cell A1 with category items like "All", "Online store", "Department store", "Specialized store" and so on. Then, from cell B1 to X1 I have the before mentioned categories except "All". </p>
  
  <p>I want to hide all columns except the ones from the category selected in the dropdown validation list. Also I need to unhide all columns if I select "All" in the list.</p>
  
  <p>I found a sample code on the Internet which works fine to hide the non selected categories -but quite slow response when changing selection-. But I could not make it works together with a code to unhide all columns. </p>
  
  <p>The related code is below. Thanks for your feedback.</p>
  
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
  
  Dim R, V
  
  If Target.Address = ("$A$1") Then
  V = [A1].Value
  For Each R In Range("B1:X1")
  R.EntireColumn.Hidden = R.Value &lt;&gt; V
  Next
  
  End If
  
  End Sub
  </code></pre>