运行时错误"1004"无法获取WorksheetFunction类的Match属性 [英] Run time error '1004' Unable to get the Match property of the WorksheetFunction class

查看:1030
本文介绍了运行时错误"1004"无法获取WorksheetFunction类的Match属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

nSectionSetupRow = Application.WorksheetFunction.Match( _
      Worksheets("Items").Cells(nRow, 1), _
      Worksheets("SectionSetup").Range("B1:B" & _
      Worksheets("SectionSetup").Range("A1").End(xlDown).Row), 0)

我在这里遇到问题,并使用Excel 97-2003工作表类型的Excel

i am facing issue here and using excel 97-2003 worksheet type of excel

推荐答案

Application.WorksheetFunction.Match如果没有匹配项,将引发运行时错误.

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

Application.Match将返回一个错误值,您可以使用IsError()

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

例如:

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

这篇关于运行时错误"1004"无法获取WorksheetFunction类的Match属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆