+ Reply to Thread
Results 1 to 9 of 9

VBA search on cell value with wildcard

  1. #1
    Registered User
    Join Date
    10-02-2017
    Location
    Swansea
    MS-Off Ver
    2007
    Posts
    14

    VBA search on cell value with wildcard

    Hi hope someone can help I have a vba that is working really well but i need to modify it slightly, currently it’s searching dependent on the value of a cell,

    Code:
    Please Login or Register  to view this content.
    this works fine if the content in “C2” is exactly right, but I’m using for ref numbers and they are long and complex is there a way to add a wild card or something so the vba will search for all matches, for example :

    If C2 was 357, the vba would pick up 357, 2357, 3579, etc.

    hope I’ve explained this enough if you want or need more let Me know

    Thanks

  2. #2
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: VBA search on cell value with wildcard

    Try something like this

    Please Login or Register  to view this content.
    Last edited by maniacb; 03-02-2021 at 06:34 PM.

  3. #3
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,887

    Re: VBA search on cell value with wildcard

    How are you actually doing the search?
    Rory

  4. #4
    Registered User
    Join Date
    10-02-2017
    Location
    Swansea
    MS-Off Ver
    2007
    Posts
    14

    Re: VBA search on cell value with wildcard

    Hi, that would be great but there are nearly 300k of serial numbers that are 15 digest long containing letters and numbers and sorry the number I used was totally random, I need it to search for all any cell that contains a whatever is in C2.

    Hope that makes sense.

  5. #5
    Registered User
    Join Date
    10-02-2017
    Location
    Swansea
    MS-Off Ver
    2007
    Posts
    14

    Re: VBA search on cell value with wildcard

    Sorry hard to explain, but I am searching what ever is in cell C2, on multiple sheets. If I put in the full serial number it works fine. It’s a modified version of this


    https://www.youtube.com/watch?v=DOW3SjBjg6I

    Just with a much larger data set
    Last edited by Cooky857; 03-02-2021 at 07:13 PM. Reason: Bad link

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,887

    Re: VBA search on cell value with wildcard

    It would have been so much simpler to post the code or the workbook. You basically need to change this:

    Please Login or Register  to view this content.
    to something like:

    Please Login or Register  to view this content.

  7. #7
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent SAC
    Posts
    8,887

    Re: VBA search on cell value with wildcard

    It would also have been nice if you'd mentioned that you have posted this in other forums too...

  8. #8
    Registered User
    Join Date
    10-02-2017
    Location
    Swansea
    MS-Off Ver
    2007
    Posts
    14

    Re: VBA search on cell value with wildcard

    Hi Rorya apologies, I did not post the sheet it the code direct as it on my pc in the office and I’m on my tablet at home, as for using another forum if that is frowned apron again apologies. Just trying to get a response ASAP as it’s driving me crazy.

    Thanks so much for you help it’s really appreciated.

    I’ll give it a go tomorrow and let you know.

  9. #9
    Registered User
    Join Date
    10-02-2017
    Location
    Swansea
    MS-Off Ver
    2007
    Posts
    14

    Re: VBA search on cell value with wildcard

    Hi your code seams to be working treat thanks very much

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Wildcard Search Range of Cells to Return That Cell Value
    By brafter70 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-13-2017, 01:29 PM
  2. Replies: 4
    Last Post: 09-23-2016, 01:22 PM
  3. [SOLVED] Wildcard Search Criteria
    By JO505 in forum Excel General
    Replies: 4
    Last Post: 11-18-2015, 03:49 PM
  4. [SOLVED] Search using wildcard
    By tapsmiled in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 07-30-2014, 07:18 PM
  5. [SOLVED] Wildcard Search
    By yccyccycc in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-12-2013, 02:22 AM
  6. [SOLVED] how to use a wildcard with an IF formula to search for text in a cell
    By nje in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 10-23-2012, 07:40 AM
  7. If, And, wildcard search
    By zachvu in forum Excel General
    Replies: 4
    Last Post: 07-14-2011, 06:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1