+ Reply to Thread
Results 1 to 8 of 8

Working code need important changes.

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

    Working code need important changes.

    Hi I have below code which I though worked perfect. But after more tests I realize that it can make errors.
    Your supposed to be able to search after customer nr, or IBAN. I though if I made the code xlWhole, it needed all digits to find a match, and then I avoided that it would search in wrong column But it can happen.
    Other error is it only display on search result, even if more with same numbers.

    I want it to be sure it can only search in column C2 and used rows down and column P2 and used rows down.

    You input the sheet name example spain. and after the full number. Customer nr is always with 8 digits and leading zeroes.

    If I now search in sheet spain with number 00000047 it only display one result even if there is 2 with that number.

    If I in sheet france search for number 00017763 it give one result but its from column G. But there could be a customer number which have this number, because of same amounts of digits. So important that it only search in column C2 and down and column P2 and down.

    Here is my code and also a little test sheet to work with.

    Thanks Sincerely

    Abjac

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Working code need important changes.

    Hi, abjac,

    maybe just change
    Please Login or Register  to view this content.
    to read
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

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

    Re: Working code need important changes.

    HI Holger and thanks the second option I tried and it works fine. It will only search in these 2 columns . But the other error is still there.

    If I in sheet france go for customer number 00007813. It only display one result. But there is 3 rows with that customer nr. Same in spain customer number 00000047 are there 2 times but it only give one result in sheet Result.

    Have a look there please.

    Sincerely

    Abjac

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Working code need important changes.

    Hi, abjac,

    But the other error is still there.
    The code you posted only does one search (it will not continue to look for more hits). I wonder why you call that an error as I think the original purpose for the code was to find an unique number/code (IBAN) and not an accountant number/code.

    I wonder why you believe you would need to use Find instead of trying to apply the Autofilter with the criteria and copy over if any data is found.

    Ciao,
    Holger

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

    Re: Working code need important changes.

    Hi Holger Your right about that. I thought from the beginning that it was only possible to have one unique number and only the IBAN. But after see the original sheets, I saw there can be duplets. And also that it was necessary to expand it with the customer nr also.
    So there I ran in to some problems. I thought first the code was ok if I made it xlWhole, but as seen its not correct.

    If you can would really need this to work.

    Please if time see if you can change the code to what I described.

    Thanks

    Abjac

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Working code need important changes.

    Hi, abjac,

    the code you use osnīt what I would call solid and reliable - Iīd go for a UserForm holding the SheetnNames available and a ListBox/ComboBox for the user to make a choice. Same goes for the customer number or Iban being filled on the available data from that sheet. But thatīs my way of coding.

    Please Login or Register  to view this content.
    Ciao,
    Holger

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

    Re: Working code need important changes.

    Thanks Holger on my mobile here. Will have and try when home again.
    Abjac

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

    Re: Working code need important changes.

    Hi Holger home here and just tested it in the big sheet- It works brilliant as usual when you make a code. Thanks so much.
    Its really a bigger help than you know.

    Have a nice evening

    Sincerely
    Abjac

+ 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. urgent
    By m7md in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-22-2014, 06:58 PM
  2. [SOLVED] Vba code working in workbook module but not working from personal.xlb
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-19-2014, 05:47 AM
  3. Replies: 1
    Last Post: 11-13-2013, 10:28 AM
  4. Code for email alerts from excel isn't working, wrong code possibly?
    By jessthorogood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2012, 01:45 AM
  5. Why are Using Standardized and Validated Code Important?
    By chili in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 03-03-2009, 11:50 AM

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