title: Using a For and If loop to match, index, data to a new cell
body: <p>I have two different sized tables of data. </p>
  
  <p><code>Table 1</code> is raw data comprised of two columns:- </p>
  
  <ol>
  <li>Dates = C31:C158 'Note that these WILL change</li>
  <li>Transaction Amounts = D31:D158</li>
  </ol>
  
  <p>I then have a smaller table, <code>Table 2</code>, that is also raw, with "Special Transactions" - we shall term it that now - with data in the following cells:-</p>
  
  <ol>
  <li>SDates = G31:G36</li>
  </ol>
  
  <p>I want to output the matching Transaction Amounts to the <code>SDates</code> - which are in the raw data. </p>
  
  <p>I have tried different iterations of loops and I will post examples of what I have tried. </p>
  
  <p>Just stumped is all. Would love some help. </p>
  
  <pre><code>Dim FR As Long  'FirstRow
  Dim LD As Long  'Last
  Dim LR As Long  'Last Row of Withdrawals
  
  'Dim Rng As Range
  
  FR = Cells(31, 7) 'Cell G31
  LD = Cells(Rows.Count, 7).End(xlUp).Row
  LR = Cells(Rows.Count, 3).End(xlUp).Row
  
   If IsEmpty(FR) = False Then 'If Cell C31 has additional inputs then ....
  
      Dim k As Long 'i
      Dim l As Long 'j
  
      For k = 31 To LD            
          If CLng(Cells(k, 7).Value) &gt; DoII Then 'DoII = Start Date, it is true in my file
              For l = 31 To LR 'Column C 31: Last ROw
  
               EMPTY EMPTY EMPTY
              Next l
  
  
  
  
  
  
  
  
  
  
          End If
      Next k
  End If
  </code></pre>
  
  <p>EDIT: Solved </p>
  
  <p>Palm to Face moment code is as follows:</p>
  
  <pre><code>    Dim k As Long 'i
      Dim l As Long 'j
  
      For k = 31 To LD
          For l = 31 To LR
              If Cells(k, "H") = Cells(l, "C") Then
                  Cells(k, "I") = Cells(l, "D")
              End If
          Next l
      Next k
  End If
  </code></pre>