Results 1 to 9 of 9

Thread: Excel 2013>VBA>Match>Wildcard

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,645
    TextBox1.Text = abc
    A14 = klmn abcdef sdfg thylll
    A23 = xcd abcdef sd

    below returns klmn abcdef sdfg thylll, which is the first match.
    Sub test()
         'Label2.Caption = Sheets("Sheet1").Cells(Application.Match("*" & TextBox1.Text & "*", Sheets("Sheet1").Range("A1:A30"), 0), 1).Value
        MsgBox Sheets("Sheet1").Cells(Application.Match("*" & "abc" & "*", Sheets("Sheet1").Range("A1:A30"), 0), 1).Value
    End Sub
    so what do you mean by "extreme deviation"?
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  2. #2
    VBAX Regular
    Joined
    May 2016
    Posts
    73
    Location
    Regarding "extreme deviation," Suppose the string I want to record in my database is "Abunayyan" but the input is "A Abunayyan Trading Company"...how would I search my list of 30 companies and match to "Abunayyan" so that I can record that text in my database?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •