Harshil Mehta
Board Regular
- Joined
- May 14, 2020
- Messages
- 85
- Office Version
- 2013
- Platform
- Windows
I want to delete rows if the code finds a match from the list in another sheet.
The below code does not delete all the rows where the match is found in one go.
The below code does not delete all the rows where the match is found in one go.
VBA Code:
Sub Delete_Newlyadded()
Dim Cl As Range
Dim Dic As Object
Set Dic = CreateObject("scripting.dictionary")
With Sheets("Definition.Temp")
For Each Cl In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
Dic(Cl.Value) = Cl.Value
Next Cl
End With
With Sheets("New.Temp")
For Each Cl In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
If Dic.Exists(Cl.Value) Then
Cl.EntireRow.Delete
End If
Next Cl
End With
End Sub