Run time error '1004' Unable to get the Match property of the WorksheetFunction class

后端 未结 1 718
难免孤独
难免孤独 2021-01-28 13:45
nSectionSetupRow = Application.WorksheetFunction.Match( _
      Worksheets(\"Items\").Cells(nRow, 1), _
      Worksheets(\"SectionSetup\").Range(\"B1:B\" & _
      W         


        
1条回答
  •  不知归路
    2021-01-28 14:10

    Application.WorksheetFunction.Match will raise a run-time error if there's no match.

    Application.Match will instead return an error value which you can test for using IsError()

    E.g:

    Dim m 'variant
    m = Application.Match(lookupValue, lookupRange, 0)
    If Not IsError(m) Then
        'got a match
    Else
        'no match
    End If
    

    0 讨论(0)
提交回复
热议问题