fari1
Active Member
- Joined
- May 29, 2011
- Messages
- 362
Code:
Sub newcode()
startrow = 2
Sheets("statement").Select
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Sheets("sheet1").Select
sheet1rows = Cells(Rows.Count, "A").End(xlUp).Row
For Y = 1 To sheet1rows
Sheets("sheet1").Select
searchvalue = Cells(Y, "A").Value
Sheets("statement").Select
For X = lastrow To startrow Step -1
If Cells(X, "A").Value = searchvalue Then Cells(X, "A").EntireRow.Delete
Next
Next
End Sub
it finds and delete based upon whatever is in column A of sheet1.
it works perfect except for one little problem.
e.g its deletes all the rows, where there's just apple in a single cell, it wont consider those rows where there's apple in the long text strings. say in row A5 i've text string, i like apple, then it wont delete that row, while i want it to delete that as well