title: Excel VBA - ActiveCell.Column in a for each loop
body: <p>This is kind of a follow up question to my previous question but I am trying to make a code a little more dynamic. As I am looping through a row, I am trying to use ActiveCell.Column to get the active column for a particular instance. However, after printing out what the ActiveCell is, it is not going along the row correctly, like the loop is. Any ideas as to why this might be happening?</p>
  
  <p>Code: </p>
  
  <pre><code>Set rw = Range("A5:CG5")
  myCol = ActiveCell.Column
  
  
  For Each row In rw.Rows
      For Each cell In row.Cells
          Select Case cell.Value
  
          Case "2"
              ThisWorkbook.Worksheets("Sheet1").Range("E27:E51").Copy Destination:=Sheets("Sheet2").Cells(31, myCol)
  
          Case "61"
              ThisWorkbook.Worksheets("Sheet1").Range("U36:U51").Copy Destination:=Sheets("Sheet2").Cells(40, myCol)
  
          End Select
      Next cell
  Next row
  </code></pre>
  
  <p>Where myCol is the activecell.column but when printing it out it either skips columns all together or stays on the same column the entire time.</p>