+ Reply to Thread
Results 1 to 14 of 14

Search for multiple amounts and copy complete row

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Search for multiple amounts and copy complete row

    Hi I have below Sheet. Which have been working when i search for invoices. (The same setup)
    Now i need to make one for search for multiple amounts.
    The system is that you paste the numbers you want to search for in Sheet 2 Start A1
    Then you rund the code. And the result comes in sheet "Final result".

    This setup was working for invoices, but they had much longer numbers.
    My problem is that i cant change how the numbers have to be put in. They have to be like in sheet 4. And when i example search for 73, it comes with many result. It should only be one.
    It find all rows, where 73 are present.
    I need that to be changed so it only find the exact amount or amounts i put in.

    Please take a look at the sheet. And try it from there. More easy to understand i think.

    Please note that you can only save with the button on sheet 1.


    Hope for some help.

    Thanks

    Sincerely Abjac
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Search for multiple amounts and copy complete row

    Abjac,
    In which column in sheet 4 is the search amount? Is it column A? Sheet2 row 1 is blank, Are you trying to put the amount you wish to search in sheet 2 row 1, so that the code looks in this row and search this amount in sheet 4 column A?

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Search for multiple amounts and copy complete row

    Your sheet is protected with a password. Could you please remove it?

  4. #4
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Search for multiple amounts and copy complete row

    HI AB33. Sorry had problem logging in here. I have uploaded it again without password sorry for that. The amount you search after is in Sheet 4 column H.
    What happen is that you paste some numbers into sheet 2 from column A1. The macroes take these put in numbers and change them to a string with comma(, this one smile) between.
    Then it put these string numbers into the other code SetWorksheet1, where it search after the amounts, you have put in.

    The best way to test it in the beginning is to copy some of the numbers from column H sheet 4, and paste them into Sheet 2 column A1. It have to only find the amount of rows. But it find more. If you example put 73 in. It should oply find one row. But it find all, which have the number 73 inside..

    Hope it makes sense or that i explain it correct.

    Here is the un coded sheet. Sorry for that

    Sincerely

    Abjac
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Search for multiple amounts and copy complete row

    Abjac,
    Not sure I am getting what you are after.
    I understand sheet Final Result is where when the code finds in column H of sheet 4 will be pasted. But what are the role of the other two sheets? How do these two sheets 1 and 2 relate to the other two sheets? Are the values to be searched will be in sheets 2 row 1?

  6. #6
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Search for multiple amounts and copy complete row

    Hi AB33 Sheet 1 is just like the place where you press the buttons and activate the macroes.

    Sheet 2 is a little special. You paste the numbers into Column A1 the one you want to search for.
    What happen in the macro, is that it make this column of numbers into a string i think its in B2 all numbers with comma between and then it copy the string numbers into the main macro.
    Which is the one called SetWorksheet1.
    So if you wnat to try it, you have properly to paste some of the numbers into A1 sheet 2 and press the button. The result is wrong, because it find example all with the number 73 inside, means it will also find 1732 and 2732 and so on, so the result is wrongg. I need it to be able to only find the exact amount if characters, we paste in.
    Hope its understandable.
    sincerely
    Abjac

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Search for multiple amounts and copy complete row

    Abjac,
    Okay! You have a code which is not working. I put 73 in sheet 2 A1 and press the "Search Multi amount button" in sheet1, and got an error. Since you have many codes on the module, could you please tell me which code is used for this task, so I can see the code.
    As there is still problem with the site, you could PM if the site has gone back to Seista

  8. #8
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Search for multiple amounts and copy complete row

    Hi AB33. Yes it have siesta my place many times.

    This is the main code. If you put 73 in A1 sheet 2 it should find too many, because it find all which have the 73 inside.

    Here is the main code which find the amount.

    Sincerely

    Abjac

    Please Login or Register  to view this content.

  9. #9
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Search for multiple amounts and copy complete row

    Try using just this code, assign your search macro button to this code

    Please Login or Register  to view this content.
    Last edited by mike7952; 02-19-2013 at 01:58 PM.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Search for multiple amounts and copy complete row

    Please Login or Register  to view this content.
    Last edited by AB33; 02-19-2013 at 12:54 PM.

  11. #11
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Search for multiple amounts and copy complete row

    HI I have tried and teste both codes very much. Mike your code is brilliant. Very fast and i cant find any errors there.
    AB33 your code is working, but more slowly and it make the wrong result.
    You can bot try to compare. I have deleted some of the macroes, which is not needed, and connected the one for yours AB33, which shall be together.

    Thanks alot both. I will mark this as solved, but AB33 if you want i will off course test yours more. You can both see the sheet below uploaded and test with the numbers i put in sheet 2 it seems Yours AB33 have problem with the dubletes.

    Thanks allot for the its brilliant

    Have a nice evening

    Sincerely

    Abjac
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Search for multiple amounts and copy complete row

    Abjac,
    When I run it with out your other codes, it worked fine. Mind you, you have a split function in B2, which requires the cell to be formated as text, otherwise, the code will find nothing.

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Search for multiple amounts and copy complete row

    Abjac,
    I have also run Mike's code. Both codes are different. On your code, you had a split function. My understanding was you have the option of searching for multiple values, but all values are in B2, separated by comma. So the code loops through each values. I coded mine based on the code you had provided. Never mind, you have got the solution from Mike-That is what matters.

  14. #14
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Search for multiple amounts and copy complete row

    HI AB33. Yes i think thats true. I am not yet so brilliant to these codes, but learning every day, from you guys. And its great. But the code i provided had this split function. It was based on a code where i find longer invoice numbers. And here its working perfect. Because i think now that these invoice numbers are much longer. But your right i can see that now. But what matters is that i get good help here from you and others. And that is really great. This code have to be used to find numbers from another application. And i guess it will save quite many hours.

    So thank you AB33 for supporting with all the help. Its really great.

    Have a nice evening. I think we have some quite big timedifference haha)

    Sincerely

    Abjac

+ 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