title: Macro to move rows to another sheet based on cell value
body: <p>The below macros works for - I have a workbook with two sheets (Active and Archive). And in Active sheet i have AB column that contains Active or Archive status. If its status Archive macros cuts and moves the row to the sheet Archive. This macros works perfect. </p>
  
  <p>Now i need to add some other sheets to excel and named them (New, Accepted, Rejected) and of course i add the same status to the column AB. Now i want macros to do the same if AB = Archive or New or Accepted or Rejected cut and move the row to the sheet named Archive or New or Accepted or Rejected. 
  I tried it by myself but can't do it. </p>
  
  <p>Need ur help. Thanks in advance.</p>
  
  <pre><code>Private Sub CommandButton1_Click()
      Dim x As Integer
      Dim y As Integer
      Dim i As Integer
      Dim shSource As Worksheet
      Dim shTarget1 As Worksheet
  
      Set shSource = ThisWorkbook.Sheets("Active")
      Set shTarget1 = ThisWorkbook.Sheets("Archive")
  
      If shTarget1.Cells(2, 28).Value = "" Then
          x = 2
      Else
          x = shTarget1.Cells(2, 28).CurrentRegion.Rows.Count + 1
      End If
  
      i = 2
  
      Do Until shSource.Cells(i, 28) = ""
          If shSource.Cells(i, 28).Value = "Archive" Then
              shSource.Rows(i).Copy
              shTarget1.Cells(x, 1).PasteSpecial Paste:=xlPasteValues
              shSource.Rows(i).Delete
              x = x + 1
              GoTo Line1
          End If
          i = i + 1
      Line1: Loop 
  End Sub
  </code></pre>