title: MS Excel VBA - Looping through columns and rows
body: <p>Hello stackoverflow community,</p>
  
  <p>I must confess I primarily code within MS Access and have very limited experience of MS Excel VBA.</p>
  
  <p>My current objective is this, I have an "Expense Report" being sent to me with deductions, this report has many columns with different account names that may be populated or may be null. </p>
  
  <p>My first step will be to start on the first record (Row 14; Column A-K contains personal info regarding the deduction) then skip to the first deduction account (deduction accounts start at column L and span to column DG) checking if each cell is null, if it is then keep moving right,If there is a value present, I need to copy it into an external workbook "Payroll Template" starting at row 2 (Column J for the deduction itself), as well as copy some personal info from the original row in the "Expense Report" related to that deduction (currRow: Column C,E,F from "Expense Report" to "Payroll Template" Columns B,C,D). </p>
  
  <p>Then move to the right until the next cell contains a value, and repeat this process on a new row in the "Payroll Template". Once the last column (DG) has been executed I want to move to the next row (row 15) and start the process again all the way until the "LastRow" in my "Used Range".</p>
  
  <p>I greatly appreciate any feedback, explanations, or links that may point me towards my goal. Thank you in advance for taking the time to read though this!</p>
  
  <p>Current state of code:</p>
  
  <pre><code>`&lt; Sub LoadIntoPayrollTemplate()
  Dim rng As Range
  Dim currRow As Integer
  Dim UsedRng As Range
  Dim LastRow As Long
  
  
  
  Set UsedRng = ActiveSheet.UsedRange
  currRow = 14
  
  
  Set wb = ActiveWorkbook '"Expense Report"
  Set wb2 = MyFilepath '"Payroll Template"
  
  
  'Copied from another procedure, trying to use as reference         
  LastRow = rng(rng.Cells.Count).Row
  Range("A14").Select
  Do Until ActiveCell.Row = LastRow + 1
      If (ActiveCell.Value) &lt;&gt; prev Then
  
          currRow = currRow + 1
  
      End If
  
      ActiveCell.Offset(1, 0).Select
  Loop
  
  With Worksheets("Collections")
      lstRow = .Cells(.Rows.Count, 1).End(xlUp).Row
      Set rng = .Range(.Cells(14, 12), Cells(lstRow, 111))
  End With
  
  End Sub&gt;`
  </code></pre>