title: How to copy row if it contains certain text to another sheet using VBA
body: <p>I am trying to write a macro that copies a row if a cell in that row contains text (For ex: Mumbai, Delhi etc) from Column C.</p>
  <p>For example if there are 30 rows but only 15 contains text(Mumbai &amp; Delhi) in column C. I want to copy those 15 rows and paste them into &quot;Sheet2&quot;
  I was using the below code. however it only copying &quot;Mumbai&quot;. I need the for loop go through the same column and copy &quot;Delhi&quot; as well.</p>
  <pre><code>Sub test()
  Dim lastrow As Long, erow As Long
  lastrow = Worksheets(&quot;Sheet1&quot;).Cells(Rows.Count, 1).End(xlUp).Row
  For i = 7 To lastrow
  If Worksheets(&quot;Sheet1&quot;).Cells(i, 3) = &quot;Mumbai&quot; Then
  Worksheets(&quot;Sheet1&quot;).Cells(i, 1).copy
  erow = Worksheets(&quot;Sheet2&quot;).Cells(Rows.Count, 1).End(xlUp).Row
  Worksheets(&quot;Sheet1&quot;).Paste Destination:=Worksheets(&quot;Sheet2&quot;).Cells(erow + 1,1)
  Worksheets(&quot;Sheet1&quot;).Cells(i, 3).copy
  Worksheets(&quot;Sheet1&quot;).Paste Destination:=Worksheets(&quot;Sheet2&quot;).Cells(erow + 1,2)
  End If
  Next i
  End Sub
  </code></pre>
  <p>Please let me know how can use And function in the above code. or any other way to copy it into sheet2.
  Thank you.</p>