+ Reply to Thread
Results 1 to 21 of 21

Lookup ID number (format number) in a textbox - Excel VBA

  1. #1
    Registered User
    Join Date
    02-04-2018
    Location
    Sumatera, Indonesia
    MS-Off Ver
    MS Office 2010
    Posts
    29

    Lookup ID number (format number) in a textbox - Excel VBA

    Lookup ID number (format number) in a textbox - Excel VBA
    Hi,

    How the best way to store ID number format, is it text or number?
    I am lookup the ID number to get name, department, etc. I found no problem if the ID number is in text format, but when I changed the format into number nothing happen.

    Below the detail:
    ComboBox8 = ID Number
    TextBox20 = Name
    TextBox21 = Department
    Sheets("Employ") = data source
    Column F = ID Number
    Column G = Name
    Column H = Department

    I use AfterUpdate_event as below:

    Please Login or Register  to view this content.
    How to fix the code above so I can do lookup even if ID Number is in number format?

    Thank you

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    https://www.excelforum.com/excel-pro...excel-vba.html
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-04-2018
    Location
    Sumatera, Indonesia
    MS-Off Ver
    MS Office 2010
    Posts
    29

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Dear jindon,

    I used your code. It works. Your code used to call/extract the last loan number. The current problem is the code for vlookup the name of employee and department based on ID Number. The name of employee and department is showing up if the format is text, but if the format of ID Number is number then it gave me nothing.

    Thank you

  4. #4
    Registered User
    Join Date
    02-04-2018
    Location
    Sumatera, Indonesia
    MS-Off Ver
    MS Office 2010
    Posts
    29

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Dear jindon,

    Below the code:
    Please Login or Register  to view this content.
    Best regards

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Upload you workbook, so it will be clearer.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Quote Originally Posted by PrimaSatria View Post
    I used your code. It works. Your code used to call/extract the last loan number. The current problem is the code for vlookup the name of employee and department based on ID Number. The name of employee and department is showing up if the format is text, but if the format of ID Number is number then it gave me nothing.

    Thank you
    Did you even test the code I posted?

  7. #7
    Registered User
    Join Date
    02-04-2018
    Location
    Sumatera, Indonesia
    MS-Off Ver
    MS Office 2010
    Posts
    29

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Dear jindon,

    I used it, and apply your code. It works so fine. I just had another problem to get Employee's name and Department if change the ID Number format from text to number. But that is another subject not related with extracting the last loan number.

    So, when change or select an ID number:
    - It will tells me the last number of loan based on each ID number (it worked as the code gave by you)
    - tells me Name and Department with Vlookup (the code I wrote myself)
    Please Login or Register  to view this content.
    This lookup above is working only if ID Number is in text format, but it will show nothing if I changed the ID Number into number format.

    Thank you

  8. #8
    Registered User
    Join Date
    02-04-2018
    Location
    Sumatera, Indonesia
    MS-Off Ver
    MS Office 2010
    Posts
    29

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Dear Jindon,

    Below is the complete code
    Please Login or Register  to view this content.
    It is written in Bahasa Indonesia:
    Nama = Name
    Departemen = Department
    Alamat = Address
    Pinjaman = Loan

    lookup.png

    Best regards

  9. #9
    Registered User
    Join Date
    02-04-2018
    Location
    Sumatera, Indonesia
    MS-Off Ver
    MS Office 2010
    Posts
    29

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Dear Jindon,

    Additional information:
    - Nomor Pinjaman Terakhir = Last Loan Number
    - Nomor Induk Karyawan = Employee's ID Number
    - Jumlah Pinjaman Terakhir = Last Loan Amount

    Best regards

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Picture doesn't help.
    Quote Originally Posted by jindon View Post
    Upload you workbook, so it will be clearer.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  11. #11
    Registered User
    Join Date
    02-04-2018
    Location
    Sumatera, Indonesia
    MS-Off Ver
    MS Office 2010
    Posts
    29

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Dear jindon,

    Please find the file.

    Best regards
    Attached Files Attached Files

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Still not clear about the column.
    Try change the column letter(s)
    Please Login or Register  to view this content.

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    How to fix the code above so I can do lookup even if ID Number is in number format?
    I've missed this part
    If you want it
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    02-04-2018
    Location
    Sumatera, Indonesia
    MS-Off Ver
    MS Office 2010
    Posts
    29

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Dear jindon,

    I just want to lookup Nama (TextBox3) & Departemen (TextBox30) based on ComboBox8.value (Nomor Induk Karyawan).
    The code I have is not working since the format of ID Number (in sheets "anggota") is number not text format.

    Please Login or Register  to view this content.
    jindon.png

    Sorry for disturbing you and I really appreciate for your time, attention. You helping me a lot.

    Thanks so much.

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    See if this is what you wanted...
    Please Login or Register  to view this content.

  16. #16
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,285

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Keinginan anda bagaimana
    "ThankyouFor Attention * And Your Help!!"

  17. #17
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    PrimaSatria,

    I suggest you to remove all On Error Resume statement from every procedure.
    As the code updates textboxes, Update event code for the text boxes run with On Error statement.

    You can not find what went wrong when error is ignored.

  18. #18
    Registered User
    Join Date
    02-04-2018
    Location
    Sumatera, Indonesia
    MS-Off Ver
    MS Office 2010
    Posts
    29

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Dear jindon,

    I've tried the last code, the problem still the same. Nothing showing up in TextBox30, TextBox3 and TextBox15.
    Perhaps I will change the format of data source (ID Number) in column F sheets "anggota", from number into text

    Thank you

  19. #19
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    OK, delete ComboBox8_AfterUpdate codes and change ComboBox8_Change code to
    Please Login or Register  to view this content.

  20. #20
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,285

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    Please Login or Register  to view this content.
    after i am not run this code bellow
    then combobox8-Change run is well
    Please Login or Register  to view this content.
    Last edited by daboho; 03-01-2018 at 07:20 AM.

  21. #21
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Lookup ID number (format number) in a textbox - Excel VBA

    daboho

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    2)
    PrimaSatria,

    Further Error trapping
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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] VBA textbox populating cells in text format instead of number format
    By chrismccarthy17 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-03-2016, 07:46 AM
  2. Number Format in Textbox
    By siobeh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-02-2013, 03:44 AM
  3. Format textbox as number
    By RikadoL in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-09-2013, 02:47 PM
  4. [SOLVED] Number Format in a TextBox - VBA Calculator
    By Pulsus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2012, 11:21 AM
  5. Textbox number format
    By DSJ in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-20-2007, 03:19 PM
  6. i cant format textbox as number!
    By barkiny in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2005, 06:05 PM
  7. Format A TextBox For A Phone Number
    By Minitman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2005, 06:06 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