vba excel - find string wildcard

前端 未结 1 1928
無奈伤痛
無奈伤痛 2020-12-21 16:37

I am doing a simple search engine in excel and I want to make some wildcards, for example:

I have a cell where the user input the search term (only numbers) which sh

相关标签:
1条回答
  • 2020-12-21 16:42

    You can use a wildcard either in a loop or with Find:

    Sub dural2()
        MsgBox Range("A1:A10").Find(What:="123*56", After:=Range("A1")).Row
    End Sub
    

    or in a loop with Like:

    Sub dural()
        For Each r In Range("A1:A10")
            If r.Value Like "123*56" Then
                MsgBox r.Address
            End If
        Next r
    End Sub
    
    0 讨论(0)
提交回复
热议问题