title: VBA Macro Move Cells to top of next column based on criteria
body: <p>I have some spreadsheet data that will be in multiples columns but the number of columns will vary from 1 to 8 based on the number of entries.  I have some entries that start with the same 2 characters in this format: CF 12456  There could be only 1 of these or many of these "CF 12345"s Once the data is spread out into evenly distributed columns, I need to move all the cells with a "CF 12345" into a new column that will be the last column of data (i.e. if there are 6 columns of data, the "CF 12345" column should be to the right of column 6).  This code does all of that except it moves all the "CF 12345"s to column I (yes, I know its because that is what the code is telling it to do).  Here is the code:</p>
  
  <pre><code>Sub DiscrepancyReportMacroStepTwo()
  
      'Step 4: Find CF cells move to the top of their own column
      Dim rngA As Range
      Dim cell As Range
  
      Set rngA = Sheets("Sheet1").Range("A2:H500")
      For Each cell In rngA
          If cell.Value Like "*CF*" Then
              cell.Copy cell.Offset(0, 1)
              cell.Clear
          End If
      Next cell
  End Sub
  </code></pre>