IsError and Match function
Because you dot qualified it
And you need to specify the Range object
And you don't need to select it
Sheets("Elgin Parts").Select
FinalRowElginParts = Range("A65536").End(xlUp).Row
Range("A2:A" & FinalRowElginParts).Name = "ElginPartsRange"
For i = 2 To FinalRowText
If IsError(Application.Match("B" & i, Range("ElginPartsRange"), 0))
Then
Rows(i).Delete
End If
Next i
--
HTH
Bob Phillips
(replace somewhere in email address with googlemail if mailing direct)
"GDCross" wrote in message
...
I need to have this code delete records of parts from a worksheet that do
not
match a parts list (in sheet "Elgin Parts"). However, I get the error
"invalid or unqualified reference" when I run this code. Why is the code
".Rows(I).Delete" a problem? Any answers? Thanks, GD
FinalRowText = Range("A65536").End(xlUp).Row
Sheets("Elgin Parts").Select
FinalRowElginParts = Range("A65536").End(xlUp).Row
Range("A2:A" & FinalRowElginParts).Name = "ElginPartsRange"
For I = 2 To FinalRowText
Range("A" & I).Select
If IsError(Application.Match("B" & I, "ElginPartsRange", 0)) Then
.Rows(I).Delete
End If
Next I
|