+ Reply to Thread
Results 1 to 8 of 8

Search Function userform

  1. #1
    Registered User
    Join Date
    10-10-2021
    Location
    australia
    MS-Off Ver
    2016
    Posts
    5

    Search Function userform

    Good Day,
    I am trying to write a code for a search button which searches a listbox based a specific input set in a textbox. The values searched are number or words, and the listbox contains values from a single column. The code i found below(ctto) but i don't understand why it only works for the first column of my list box.
    SearchButton: A Button which upon clicking is supposed to initiate the search
    SearchBox: The textbox which will contain the search value
    AvailableNumberList: The listbox which contains the data
    About 20 Columns in Total but I just want to search from Column A to G
    Please Login or Register  to view this content.
    Screenshot 2021-10-10 174549.png
    Last edited by davesexcel; 10-10-2021 at 07:04 AM.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,509

    Re: Search Function userform

    can you attach a sample workbook?

    Look at the yellow banner on top of the page on how to do that.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Registered User
    Join Date
    10-10-2021
    Location
    australia
    MS-Off Ver
    2016
    Posts
    5

    Re: Search Function userform

    Please find attached.I removed the code in the Search Command Button.
    Attached Files Attached Files

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,509

    Re: Search Function userform

    How about this?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-10-2021
    Location
    australia
    MS-Off Ver
    2016
    Posts
    5

    Re: Search Function userform

    It works Mr.Bakerman but how do i make it not case sensitive when i input a value in search box either in lower or upper case.Seems for now it only works if is similar case to the current data.

  6. #6
    Registered User
    Join Date
    10-10-2021
    Location
    australia
    MS-Off Ver
    2016
    Posts
    5

    Re: Search Function userform

    and if i have a certain data that has similar value from the search column but different value on the rest of columns in the table,how do i make the search loop like a "find next"?

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,509

    Re: Search Function userform

    Case insensitive.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-10-2021
    Location
    australia
    MS-Off Ver
    2016
    Posts
    5

    Re: Search Function userform

    it is working mr baker,i removed the cbButton and did a SearchBox Change instead.But as you can see if i do have a similar value in columns that is in my searchbox it will look up for the first line that has similar value and it won't move to a second row that has similar word.i attached the file with search function with your code on it.
    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] Adding a search function in a userform
    By bruno2580 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-03-2018, 10:17 PM
  2. Search Function on Userform
    By kobiashi in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-05-2018, 10:27 PM
  3. [SOLVED] Search userform function
    By Sazza in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-04-2016, 10:46 AM
  4. [SOLVED] Search Function in UserForm
    By johan12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-01-2013, 05:56 AM
  5. Userform Search Function Autofilter Results and Repopulate Userform
    By cindy71 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-16-2012, 03:46 PM
  6. [SOLVED] Add search function textbox in userform
    By Nu2Java in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 04-23-2012, 01:47 PM
  7. Userform search and edit function help
    By adjustermn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2010, 03:35 PM

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