错误1004与excel vba中的匹配方法

我在excel中使用两张不同的工作表,每个工作表都有一组约1200个ID号码。 当参考工作表1(RG摘要)时,我试图findID在第2页(采购matrix)上显示的行号。 这是为了最终在表单1上执行一些条件格式,其中工作表2的ID在其行上具有特定值。 我对VBA知之甚less(今年夏天我只是在做实习),所以我肯定我可能会错过一些重要的概念……但是目前我得到这个错误

运行时错误“1004:无法获取WorksheetFunction类的Match属性

RowNum= WorksheetFunction.Match(ID2, Range("E10:E1500"), 0) 

在debugging时,我可以看到ID2正在携带第一次迭代的ID值,但是RowNum返回为0。

 Sub DisplayMatrix() Dim i As Integer, j As Integer, ItemID As String, rng1 As Range, _ ID2 As String, RowNum As Integer, PM As Worksheet 'initiates loop in sheet 1 'each ID is 7 cells apart For i = 14 To 1757 Step 7 'sets ID variable where ID is present If Cells(i, 2).Value <> "" Then ItemID = Worksheets("RG Summary").Cells(i, 2).Value 'finds ID in sheet2 ID2 = Worksheets("Purchasing Matrix").Cells.Find(What:=ItemID, _ LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, MatchCase:=False) 'matches ID2 and ItemID and returns row number from sheet 2 Set PM = Worksheets("Purchasing Matrix") With PM RowNum = WorksheetFunction.Match(ID2, Range("E10:E1500"), 0) End With Next i End End Sub 

更换:

 RowNum = WorksheetFunction.Match(ID2, Range("E10:E1500"), 0) 

有:

 RowNum = WorksheetFunction.Match(ID2, .Range("E10:E1500"), 0) 

(点可能很小,但重要)
(可能还有其他问题)