+ Reply to Thread
Results 1 to 10 of 10

Using option buttons and textbox for searching listbox

  1. #1
    Registered User
    Join Date
    04-24-2020
    Location
    USA
    MS-Off Ver
    WA
    Posts
    64

    Using option buttons and textbox for searching listbox

    Hi there,

    I'm sorry for not providing any code here, I have never used these two controls in excel (Searched the net and not finding anything relevant). So here is what the goal of this form. User enter Department name in the txtDepartment and select "In" or "out" in the option group, and the listbox requery for that selected options.

    Hoping to learn from your expertise. Thank you all!

    see attached snapshots.
    Attached Images Attached Images

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Using option buttons and textbox for searching listbox

    Hi, what Office version is WA?
    If you cannot provide code you have the sample from which you posted the image, can't you attach that?
    Will make it easier to explain and 'show'
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Using option buttons and textbox for searching listbox

    Maybe something like this that you want ?
    Please Login or Register  to view this content.
    2020-06-01_16-17-24.gif

    You need to name your "search" button to SEARCH,
    name the text box for Department as DEPT
    And also need to add one button with name CLEAR.
    Last edited by karmapala; 06-01-2020 at 07:00 AM.

  4. #4
    Registered User
    Join Date
    04-24-2020
    Location
    USA
    MS-Off Ver
    WA
    Posts
    64

    Re: Using option buttons and textbox for searching listbox

    karmapala,

    Thank you for your assistance, here is what I am getting. Autofilter method or Range class failed (Run-time error '1004'). Also the sub routine for PopLB is that a module(a minor correction: made it a Private sub).

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Using option buttons and textbox for searching listbox

    No go for me without a sample file

  6. #6
    Registered User
    Join Date
    04-24-2020
    Location
    USA
    MS-Off Ver
    WA
    Posts
    64

    Re: Using option buttons and textbox for searching listbox

    No worries, figured out what was wrong, your code works like a fine wine, just user error. Thank you very much!

  7. #7
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Using option buttons and textbox for searching listbox

    Quote Originally Posted by sniper1 View Post
    No worries, figured out what was wrong, your code works like a fine wine, just user error. Thank you very much!
    You're welcome, sniper1.
    Glad the code works for you.

  8. #8
    Registered User
    Join Date
    04-24-2020
    Location
    USA
    MS-Off Ver
    WA
    Posts
    64

    Re: Using option buttons and textbox for searching listbox

    Sorry for the last minute question. Is there a way you can show us how to filter a sheet with slicers? Thank you.

  9. #9
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    Re: Using option buttons and textbox for searching listbox

    Quote Originally Posted by sniper1 View Post
    Sorry for the last minute question. Is there a way you can show us how to filter a sheet with slicers?
    I'm sorry I don't know how to filter a sheet with slicers, sniper1.

    Currently I have Excel 2010, and as far as I know, make a slicer option is just for a pivot table.

    Maybe you can google it ?
    This link maybe can help you.
    Last edited by karmapala; 06-02-2020 at 03:46 AM.

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Using option buttons and textbox for searching listbox

    @sniper1: a slicer is already a filter

+ 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. Filtered data in Listbox based on Option buttons EXCEL VBA
    By saucy_spider in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-20-2018, 12:36 AM
  2. Textbox gets wrong value after searching the listbox
    By r.visser88 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-15-2017, 05:58 AM
  3. [SOLVED] Textbox and Option Buttons - If Textbox has a Value then an Option Button must be selected
    By MeerkatMatt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-08-2014, 07:45 AM
  4. [SOLVED] Option buttons to prduce a sentence into textbox
    By molesy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-31-2014, 08:52 AM
  5. Looping through userform option buttons, textbox and labels
    By Gal403 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-07-2014, 09:03 AM
  6. userform with 6 option buttons to populate 1 listbox
    By simeonmein in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-23-2013, 05:18 PM
  7. Option buttons to use for searching
    By Qppg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-14-2010, 02:38 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