title: Create a macro that would hide and show columns based on selection from a dropdown
body: <p>I am totally new to the world of macros but have done some VBScript on QTP before. I am looking to create a macro which would hide certain columns depending on the users selection from a drop down. I am unsure of the syntax and how to identify the columns I wish to hide and how to identify the cell with the drop-down.</p>
  
  <p>Here's roughly how I would see it looking - </p>
  
  <pre><code>Sub HideColumns()
      If cell(ViewType).Value = "Option 1" Then
         Cells(Column_1, Column_2).EntireColumn.Hidden = True
      ElseIf cell(ViewType).Value = "Option 2" Then
         Cells(Column_2, Column_3).EntireColumn.Hidden = True
      ElseIf cell(ViewType).Value = "Option 3" Then
         Cells(Column_3, Column_4).EntireColumn.Hidden = True
      End If
  End Sub 
  </code></pre>
  
  <p>I have named the cell with the drop-down <code>ViewType</code> in Excel - would the VBA recognize the object that way, or would I need to declare it?</p>
  
  <p>How do I identify the columns I wish to hide?</p>