+ Reply to Thread
Results 1 to 9 of 9

find textbox value in sheets and put all matching criteria in a listbox

  1. #1
    Registered User
    Join Date
    09-08-2014
    Location
    Medan
    MS-Off Ver
    2007
    Posts
    5

    find textbox value in sheets and put all matching criteria in a listbox

    Excuse me, I'm having a problem with this vba
    I'm new in vba for excel and I want to make a program which I can input data using userform and then search the data by using other form (I make 4 different userform). All the data is in one sheet, and the search criteria that I want to find is in column B.
    My problem is I can't make find code yet.
    I try to copy some code (just in search code) from excel-it.com database but I'm having trouble since it said that "object variabel or with block variable not set"

    Would you please tell me what is wrong with my code

    Please Login or Register  to view this content.

    Thanks before
    Last edited by JBeaucaire; 10-16-2014 at 12:42 AM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365 ProPlus
    Posts
    9,535

    Re: find textbox value in sheets and put all matching criteria in a listbox

    With block variable is MyData (a range) which is declared as a Range but not defined. Set MyData to let the code know that what is range MyData.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: find textbox value in sheets and put all matching criteria in a listbox

    If you can provide a sample spreadsheet..
    May be then we can provide you a better code..
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    2013 on Win10 (desktop), 2007 on Win10 (notebook)
    Posts
    8,016

    Re: find textbox value in sheets and put all matching criteria in a listbox

    Hi, edwinsihaloho,

    the origional concept only had one UserForm (I canīt see the reason for more than one), if you use more than one userform make sure to fully qualify your controls with the name of the userform as well.

    @sktneer:
    in the original coding MyRange is set in UserForm_Initialize.

    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

  5. #5
    Registered User
    Join Date
    09-08-2014
    Location
    Medan
    MS-Off Ver
    2007
    Posts
    5

    Re: find textbox value in sheets and put all matching criteria in a listbox

    I'm very sory
    here is the Photo of find userform and the file

    cari new.pngdata.xlsx

    What I'm trying to do is

    1. find value (NPWP or/and TahunPajak or/and TahunPemeriksaan) for each text box as seen in the picture
    2. every matching criteria goes to listbox
    3. when I click the matching criteria in the list box, other textbox change according to database (vlookup)

    I'm sorry for my english...

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    2013 on Win10 (desktop), 2007 on Win10 (notebook)
    Posts
    8,016

    Re: find textbox value in sheets and put all matching criteria in a listbox

    Hi, edwinsihaloho,

    I doubt itīs a good idea to attach a macrofree workbook without the userforms and the code when you are asking a question about VBA.

    Ciao,
    Holger

  7. #7
    Registered User
    Join Date
    09-08-2014
    Location
    Medan
    MS-Off Ver
    2007
    Posts
    5

    Re: find textbox value in sheets and put all matching criteria in a listbox

    I am very sorry, I forget to insert it...
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-08-2014
    Location
    Medan
    MS-Off Ver
    2007
    Posts
    5

    Re: find textbox value in sheets and put all matching criteria in a listbox

    I am very sorry, I forgot to insert it...

    Here it is

    Jabu Pari.xlsm

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    2013 on Win10 (desktop), 2007 on Win10 (notebook)
    Posts
    8,016

    Re: find textbox value in sheets and put all matching criteria in a listbox

    Hi, edwinsihaloho,

    you should copy the codes as they are listed.

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

+ 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] Highlight matching string in Listbox based on Textbox value
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-26-2014, 11:04 AM
  2. Code to find matching record in listbox on sheet.
    By Nitefox in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2014, 04:07 AM
  3. Delete from 2 sheets if matching criteria
    By motown in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-13-2009, 03:22 PM
  4. Matching Criteria Between Sheets?
    By motown in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2008, 12:44 PM
  5. How can find a value using two different matching criteria?
    By Dinesh in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-09-2006, 07:25 PM

Tags for this Thread

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