Results 1 to 3 of 3

Filling a listbox with unique entries in a row based on certain criteria

Threaded View

  1. #1
    Registered User
    Join Date
    09-30-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2010
    Posts
    2

    Filling a listbox with unique entries in a row based on certain criteria

    Hey everyone,

    I'm still fairly new to VBA and am trying to create a - by my standards - complicated sheet with control elements. The idea is that the user chooses two data properties in two drop down menus. Then, the listbox is supposed to fill with unique values that are based, or filtered if you will, depending on those properties.

    For the filling with unique entries I am currently using a collection code that I borrowed from another forum post. It looks like this:

    'Fills the left textbox with all available CG3s and sorts them alphabetically
    Dim myHeight As Integer
    Dim myWidth As Integer
    Dim myRange As Range
    Application.ScreenUpdating = False
    
    'Finds the last cell with data in a given column
    Call LastRow(5)
    lstCG3base.Clear
    myHeight = lstCG3select.Height
    myWidth = lstCG3select.Width
    
    With Worksheets("Raw_Data")
    Me.lstCG3base.List = GetUniqueItems(.Range(.Cells(5, 8), .Cells(iRowNum - 1, 8)))
    End With
    Call SortListBox(Worksheets("CG3").lstCG3base)
    With lstCG3base
        .Width = myWidth
        .IntegralHeight = False
        .Left = 27.75
        .Top = 189
        .Height = myHeight
        .Width = myWidth
        .IntegralHeight = True
        .Left = 27.75
        .Top = 189
        .Height = myHeight
        .Width = myWidth
    End With
    Now what it's supposed to do is to look within the row of a cell whether the properties selected in the dropdown menu are met, and either add or don't add the unique entry to the listbox depending on that.

    The cool thing about the above code is that it's very fast, as the list I'm dealing with is quite big. Is there any way to accomplish this, or do I need to rethink the entire filling code?

    Thank you very much in advance

    PS: I meant entries in a COLUMN in the title, not a row.
    Last edited by grzzzly; 10-07-2013 at 05:16 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Filling multiselect listbox based on closed workbook data
    By FKurzhals in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 08-23-2013, 02:56 PM
  2. [SOLVED] Count unique entries across columns based on criteria
    By flomme in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-15-2013, 06:43 PM
  3. [SOLVED] Count Unique Pairs of Excel Entries Based on Criteria
    By DonFord81 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-22-2013, 01:12 PM
  4. Unique Entries with Criteria
    By Leopold2000 in forum Excel General
    Replies: 6
    Last Post: 12-04-2012, 03:46 PM
  5. [SOLVED] How do I return the unique entries from a column to a listbox
    By Dave Mc in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-09-2005, 04: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