title: Selecting one column from each row in a table
body: <p>I have a table structured (Table Name: Table2) like below:</p>
  
  <p><img src="https://i.stack.imgur.com/BYn9K.jpg" alt="Table data"></p>
  
  <p>Using VBA, I want to select ONLY a single column value of the current row by iterating over each row.
  Here is the code and I wrote:</p>
  
  <pre><code>Function findColumnValue(strColCombIdent As String, strColumnName As String) As String
      On Error Resume Next
  
         Dim strRetResult As String
  
          Dim wsMapMasterRefSheet As Worksheet
          'Referes to the table Table2.
          Dim loMapMaster As ListObject
          Set wsMapMasterRefSheet = ThisWorkbook.Worksheets("Sheet3")
          Set loMapMaster = wsMapMasterRefSheet.ListObjects("Table2")
  
          'All rows of the table Table2
          Dim rAllRows As Range
          Set rAllRows = loMapMaster.DataBodyRange
  
          'Holds one row from the databody range for processing.
          Dim rCurrRow As Range
  
          'Process data
          Dim strTemp As String
  
          For Each rCurrRow In rAllRows
  
              strTemp = rCurrRow.Columns(2)
  
              Debug.Print strTemp
          Next rCurrRow
  
      findColumnValue = strRetResult
  End Function
  </code></pre>
  
  <p>I was hoping to get results like below (ONLY the value of the column 2):</p>
  
  <pre><code>1.5
  1.5
  1.8
  4
  3
  3
  1
  2
  
  10
  12
  5
  7
  </code></pre>
  
  <p>Instead I end up with something like this (All values from column#2 onwards, for each processing row.)</p>
  
  <pre><code>1.5
  0.045150462962963
  
  1.5
  4.52083333333333E-02
  
  1.8
  4.72685185185185E-02
  
  4
  0.168090277777778
  
  3
  3.1
  
  3
  8.47800925925926E-02
  
  1
  4.16666666666667E-02
  
  2
  8.33449074074074E-02
  
  
  
  
  10
  10.1.1.1
  
  12
  1.3.4.5
  
  5
  0.212511574074074
  
  7
  8.54166666666667E-02
  </code></pre>
  
  <p>Using </p>
  
  <pre><code>strTemp = rCurrRow.Columns(1, 2)
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>strTemp = rCurrRow.Columns(2)
  </code></pre>
  
  <p>Causes runtime error 1004</p>
  
  <p>Since each iteration points to a range object in the For loop; I was thinking using</p>
  
  <pre><code>rCurrRow.Columns(2)
  </code></pre>
  
  <p>will point to current Row's column#2 and hence print out only the column's value.
  Is my logic misplaced?</p>
  
  <p>One additional question:</p>
  
  <p>Why does the MSDN Excel Reference guide describes Columns as a Property; where as clearly the "Columns" usage clearly takes parameters</p>
  
  <p>Here is the link I referred:
  <a href="http://msdn.microsoft.com/en-us/library/office/ff197454(v=office.15).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/office/ff197454(v=office.15).aspx</a></p>