+ Reply to Thread
Results 1 to 9 of 9

Search code please check

  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    22

    Search code please check

    Hi,

    Friends can you help me out with this one,

    I want to make a search with 1800 rows. code is below, have 3 options to search in 3 columns (H, C & F), and once it finds the result it will display the containing rows. attached is the userform for information

    this problem of mine is in relation with

    http://www.excelforum.com/excel-prog...ease-help.html

    thanks..

    ---------
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by davesexcel; 05-05-2012 at 08:41 AM. Reason: code tags required, please read the Foum Rules

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Search code please check

    You reuse your descriptions, so you shouldn't be searching for that string, it won't be reliable. Other than that, I would do it this way:

    Please Login or Register  to view this content.

    On your form, perhaps highlight that only the Submittal No and Document Reference fields will be used for a FIND.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    04-05-2012
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Search code please check

    thanks , just followed to find submittal no and document reference and doesnt even give a correct result.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Search code please check

    Since the form is simply doing text string comparisons and your technique was OR and not AND, you will need to decipher the problem with your data. Look at the Doc Ref or Submittal No you used to test and then compare what you got back when you test. Why did you get that result? The answer will be in the data.

  5. #5
    Registered User
    Join Date
    04-05-2012
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Search code please check

    clearly I check an compared and the thing is whenever I tried to test and used submittal no to search it gives me only 1 result, i tried search different submittal no. and still I got 1 answer.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Search code please check

    The 1 result was from an incorrect row? You really aren't telling me anything I can comment on.

  7. #7
    Registered User
    Join Date
    04-05-2012
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Search code please check

    Hi JBeaucaire

    lets go back to the beginning maybe I am wrong on the way write it.

    Its aim is to make a search from either;
    1) column "C" to search a Submittal No. (4 digit) or
    2) column "H" to search a KEYWORD (any specific word)

    Note: Lets not use anymore the Document Ref. coz i find it not useful, 2 columns are enough.

    from your above code, if i'll type 1200 at the submittal no. to search I should get the result.

    Submittal No. CJ177/BHP/TS/COD/1200
    Revision No. 0
    Document No.
    Document Rev. No.
    Description OPERATION & MAINTENANCE MANUAL FOR SPA & SWIMMING POOL
    Date Prepared 16/04/12
    Consultant Received 18/04/12

    but whenever I try to make another search (another Submittal No.), it gives same result..

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Search code please check

    Ah.... you want to:

    1) only search by a partial string
    2) use the same string to search again and get a different result.

    Ugh. You're code doesn't even come close to that.

    Ok, i converted your DocRef field into a FindRef field so we can keep track of previous "clicks" on the FIND button. And I've updated the code so only one search box or the other can be used. (see the code changes in the workbook)

    Now this code works to do what you want:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    04-05-2012
    Location
    UAE
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Search code please check

    So thankful that you drop by and look at the code. The code that I 1st used was adopted from Jraj1106 and thought that I can somehow manipulate it and use it on my userform. I found it hard to do it in this way.

    Now that partly of my userform is done, i can move on to the next one. BTW thank you very much for the help...

+ 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