Hello,
I am looking for help with a macro, or a entirely new macro. Here is my situation:
I have a list of data (Sheet2)
I have a list of terms in Sheet 1 that i need to delete the entire row from Sheet 2. The macro provided works but it seems to only delete the first time each of the terms listed on sheet 1 appears on sheet 2. In turn i have to run the macro about 50-75 times to remove all the terms that i want deleted. The data in Sheet 2 is updated and refreshed every 6 days so having to run the macro 50 times seems to be a bit impractical. Below is the macro i've been using, if you want to "tweek" it feel free to or if you have one that works better. let me know.
Sub delete()
Application.ScreenUpdating = False
Dim rFound As Range
On Error Resume Next
For Each cell In Sheets("Sheet1").Range("A1:A99" & Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row)
With Sheets("Sheet2").Columns(1)
Set rFound = .Find(What:=cell, After:=.Cells(1, 1), LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False)
If Not rFound Is Nothing Then
.Cells(rFound.Row, rFound.Column).EntireRow.delete xlUp
End If
End With
Next cell
Application.ScreenUpdating = True
End Sub
Thanks!
I am looking for help with a macro, or a entirely new macro. Here is my situation:
I have a list of data (Sheet2)
I have a list of terms in Sheet 1 that i need to delete the entire row from Sheet 2. The macro provided works but it seems to only delete the first time each of the terms listed on sheet 1 appears on sheet 2. In turn i have to run the macro about 50-75 times to remove all the terms that i want deleted. The data in Sheet 2 is updated and refreshed every 6 days so having to run the macro 50 times seems to be a bit impractical. Below is the macro i've been using, if you want to "tweek" it feel free to or if you have one that works better. let me know.
Sub delete()
Application.ScreenUpdating = False
Dim rFound As Range
On Error Resume Next
For Each cell In Sheets("Sheet1").Range("A1:A99" & Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row)
With Sheets("Sheet2").Columns(1)
Set rFound = .Find(What:=cell, After:=.Cells(1, 1), LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False)
If Not rFound Is Nothing Then
.Cells(rFound.Row, rFound.Column).EntireRow.delete xlUp
End If
End With
Next cell
Application.ScreenUpdating = True
End Sub
Thanks!