簡體   English   中英

Excel 2007 VBA MATCH函數找不到匹配項,但是該范圍內是否存在匹配項?

[英]Excel 2007 VBA MATCH function is not finding a match, but a match does exist in that range?

在Excel 2007 VBA中-以下“我的匹配”語句找不到文本。 它在那里,並且在指定范圍內。 我沒有出現異常錯誤。 只是找不到。 這是AZ65單元格中的全文-與“ Cricut單肩包”相關的更多項目

If Not IsError(Application.Match("More items related to*", Range("az1:ba1000"))) Then
removeSomeRows = Application.Match("More items related to*", Range("az1:ba1000"))
Range("az" & removeSomeRows & ":" & "bz1000").ClearContents
End If

在工作表上,這也不起作用

=MATCH("More items related to*",AZ1:Ba1000)

您必須使用0的MatchType才能使用通配符(*或?),請參閱: http : //office.microsoft.com/zh-cn/excel-help/match-function-HP010062414.aspx

使用Application.Match("More items related to*", Range("AZ1:AZ1000"), 0)

另外,您也可以使用以下方法:

Dim rng as Range

For Each rng in ActiveSheet.Range("AZ1:BA1000")
    If InStr(1, "More items related to", rng) <> 0 Then
        rng.ClearContents
    End If
Next

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM