fari1
Active Member
- Joined
- May 29, 2011
- Messages
- 362
hi, i want to do a loop, which will do the following
for every cell value in column A of sheet1, it'll find those value in sheet2 column A, if finds, then it'll delete that row,
i've a code that does this, but it is based upon the fixed value, while istead of a fixed value, i want to define a column for this
please help me with this
for every cell value in column A of sheet1, it'll find those value in sheet2 column A, if finds, then it'll delete that row,
i've a code that does this, but it is based upon the fixed value, while istead of a fixed value, i want to define a column for this
Code:
Sub deletefor()
startrow = 2
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
With Application
CurrentScreenUpdating = .ScreenUpdating
CurrentCalculate = .Calculation
CurrentEnableEvents = .EnableEvents
.ScreenUpdating = False
.Calculation = xlCalculationManual
.EnableEvents = False
End With
For X = lastrow To startrow Step -1
If Cells(X, "A").Value Like "*for*" Then Cells(X, "A").EntireRow.Delete
Next
With Application
.ScreenUpdating = CurrentScreenUpdating
.Calculation = CurrentCalculate
.EnableEvents = CurrentEnableEvents
End With
End Sub
please help me with this