When I run the following code excel stops responding after a while(5-6 secs)
What it does:
Gets Value in e1
checks if present on either of the two sheets wo
or wn
if yes then move the row from which e1
got it's value to another sheet wr
if not found then do nothing
Option Explicit
Sub RemoveEmail()
Dim wi, wn, wo, wr As Worksheet
Dim e1
Dim FinalRowI, FinalRowN, FinalRowO, FinalRow
Dim i, j
Set wi = Sheet2
Set wn = Sheet3
Set wo = Sheet4
Set wr = Sheet5
FinalRowI = wi.Range("B1048576").End(xlUp).Row
FinalRowN = wn.Range("C1048576").End(xlUp).Row
FinalRowO = wo.Range("C1048576").End(xlUp).Row
FinalRow = WorksheetFunction.Max(FinalRowN, FinalRowO)
For i = 2 To FinalRowI
e1 = Trim(wi.Range("B" & i).Text)
For j = 2 To FinalRow
If Trim(wn.Range("C" & j).Text) = e1 Or Trim(wo.Range("C" & j).Text) = e1 Then
wi.Cells(i, "A").EntireRow.Cut Destination:=wr.Range("A" & wr.Rows.Count).End(xlUp).Offset(1)
Else: End If
Application.CutCopyMode = False
Next j
Next i
End Sub