+ Reply to Thread
Results 1 to 8 of 8

.Find Not Finding Correct String

  1. #1
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    .Find Not Finding Correct String

    Hi all,

    I am having issues with Find. I have the following code
    Please Login or Register  to view this content.
    For some reason, this does not always find the exact SelStrg and I don't know why. I don't know if I should upload my workbook for this one but if you think I should then let me know. In stating this, I thought that xlWhole was used to find an exact match but it is failing me. Any suggestions?

    Regards:
    Last edited by Mordred; 11-22-2011 at 02:28 PM.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: .Find Not Finding Correct String

    you will, using:


    Please Login or Register  to view this content.
    If you don't, it's something in the worksheet (spaces, non-printable characters).



  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: .Find Not Finding Correct String

    Nope, that didn't do the trick as it is still finding the wrong selection. What a stumper.

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: .Find Not Finding Correct String

    What is it searching for and what is it finding instead?
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: .Find Not Finding Correct String

    Please be more specific about 'the wrong selection'. ( you are almost paraphrasing 'it doesn't work')
    I can't see what is in the variable 'Selstr', nor what is in the worksheet.
    (Please dive into the forum rules... )

  6. #6
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: .Find Not Finding Correct String

    Quote Originally Posted by snb View Post
    Please be more specific about 'the wrong selection'. ( you are almost paraphrasing 'it doesn't work')
    I can't see what is in the variable 'Selstr', nor what is in the worksheet.
    (Please dive into the forum rules... )
    LoL, I should give myself a warning for vagueness. The first search searches for "Aluminum Products" in the cell B40 but the search comes back with "Fabricated structural metal products" located at B37. I'm guessing that "products" is what is throwing it off. I created a different worksheet with the same table to search with the same search criteria and it worked. Not sure why.

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Cool Re: .Find Not Finding Correct String

    Did you refrain from merged cells ?

  8. #8
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: .Find Not Finding Correct String

    There are no merged cells where it matters. To solve this, I created a Code_Table that keeps the names of indices along with their unique values. I have then used the unique values to search the WsMth sheet and all is good.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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