+ Reply to Thread
Results 1 to 7 of 7

Issues displaying list from filtered range in listbox

  1. #1
    Registered User
    Join Date
    12-20-2018
    Location
    Australia
    MS-Off Ver
    office 2016
    Posts
    8

    Issues displaying list from filtered range in listbox

    Hi, I'm a little stumped. First tine really getting into VBA to any great degree. I have found some helpful forums, but I still cannot get this to work.
    I'm trying to display in a listbox called "ListBox_close" a list of filtered results from sheets "PALLETS".
    I tried the "copy special data (visable) to another sheet, and use that in a range as rowsource. Which I can do, but I do not like that method.

    Can anyone see why I cannot get this to work?



    Please Login or Register  to view this content.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Issues displaying list from filtered range in listbox

    If values in Column A are unique after filtering you could use Dictionary.

    Or use Advanced Filter to copy filterd list to an unused area of your worksheet, pull that range into an array and then delete filterd list.
    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
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Issues displaying list from filtered range in listbox

    No need for a seperate array. The listbox.list is already an array you can add or remove items to\from.

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 12-23-2018 at 08:31 AM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Issues displaying list from filtered range in listbox

    @ AlphaFrog

    Only downside to this method is that the larger your range becomes the slower ListBox gets filtered.

    From my experience AdvancedFilter is the quickest method for filtered list in ListBox.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Issues displaying list from filtered range in listbox

    Quote Originally Posted by bakerman2 View Post
    @ AlphaFrog

    Only downside to this method is that the larger your range becomes the slower ListBox gets filtered.

    From my experience AdvancedFilter is the quickest method for filtered list in ListBox.
    That's true, but it would take 1000s of rows before you would notice a significant lag.

  6. #6
    Registered User
    Join Date
    12-20-2018
    Location
    Australia
    MS-Off Ver
    office 2016
    Posts
    8

    Re: Issues displaying list from filtered range in listbox

    Thanks Guys,
    Kinda got it working. It wouldn't let me do it from the original sub called "CLOSE_PALLET_Click()" which is a cmd button. But it would let me do it from another new cmd Button.
    Go figure.

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Issues displaying list from filtered range in listbox

    You may have to qualify the userform that the listbox is on...

    Please Login or Register  to view this content.

+ 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] Displaying filtered multicolumn table in userform listbox
    By AndyE in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-31-2018, 09:58 AM
  2. combine columns from Table and displaying filtered list from data
    By mbreese in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 07-22-2018, 10:06 PM
  3. displaying a dynamic autofilter list in a listbox
    By reggie1000 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-12-2014, 10:23 AM
  4. DROPDOWN LIST ISSUES | filtered, sorting, data validation
    By rsbuslon in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-05-2014, 03:42 AM
  5. Listbox displaying empty entries at the end of the list
    By randell.graybill in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 10-27-2009, 10:00 PM
  6. [SOLVED] Displaying unique entries from a filtered list
    By [email protected] in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-26-2006, 02:00 PM
  7. [SOLVED] Filtered List as Listbox RowSource
    By Ken McLennan in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-20-2005, 08:05 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