title: Is the VBA "if" statement capable of producing different results based on the current cell selection?
body: <p>I have a macro that is intended to select the entire column in a sheet if the header has a particular value. After that section of the macro runs. I want to check to see what part of the spreadsheet is highlighted and move from there using an IF statement. If the selection is a single cell (in this case A2) then the macro should go down one path. If the selection is an entire column, then it should go down a different path. Currently it is only finding the first part of the if select. In the case of the code below it is returning   MsgBox " The " &amp; xStr &amp; " column has not been found." regardless of what the current selection is.</p>
  
  <p>I have attempted using the &lt;>, is, and isnot parameters on Active.range.select but that is where my current knowledge ends. I am a beginner at VBA and have been cobbling this code together using a ton of trial an error/ online help.</p>
  
  <pre><code>Sub Testingifthen()
  '
  ' Testingifthen Macro
  '
  
   Range("A2").Select
    numRows = Range("A" &amp; Rows.Count).End(xlUp).Row
  
  Dim xRg As Range
  Dim xRgUni As Range
  Dim xFirstAddress As String
  Dim xStr As String
  
      On Error Resume Next
      xStr = "Zip Code"
      Set xRg = Range("A2:CD2").Find(xStr, , xlValues, xlWhole, , , True)
      If Not xRg Is Nothing Then
          xFirstAddress = xRg.Address
          Do
              Set xRg = Range("A2:CD2").FindNext(xRg)
              If xRgUni Is Nothing Then
                  Set xRgUni = xRg
              Else
                  Set xRgUni = Application.Union(xRgUni, xRg)
              End If
          Loop While (Not xRg Is Nothing) And (xRg.Address &lt;&gt; xFirstAddress)
      End If
      xRgUni.EntireColumn.Select
  
      If Active.Range.Select &lt;&gt; Range("A2") Then
  
     MsgBox " The " &amp; xStr &amp; " column has not been found."
  
      Else
  
     MsgBox " The " &amp; xStr &amp; " column has been found."
  
     End If
  
  
  '
  End Sub
  </code></pre>