Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vlookup delete method of range class failed

Status
Not open for further replies.

xxentric

Technical User
Oct 14, 2009
35
0
0
US
im not sure why im getting this failure on deleting the row... i have looked at some examples of this.

here is the code...

Code:
Dim lookForRng As Range
Dim lookFor As Range
Dim rng As Range
Dim found
    Set lookForRng = ThisWorkbook.Sheets("Sheet2").Range("C3")
    Set rng = RS.Worksheets("Sheet1").Columns("A")
    For Each lookFor In lookForRng
        found = Application.VLookup(lookFor.Value, rng, 1, 0)
        If Not IsError(found) Then
           RS.Worksheets("Sheet1").Unprotect Password:="7/*-+7"
           lookFor.EntireRow.Delete
           RS.Worksheets("Sheet1").Protect Password:="7/*-+7"
        End If
    Next lookFor
 
I guess you want to replace this:
lookFor.EntireRow.Delete
with this:
found.EntireRow.Delete

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top