+ Reply to Thread
Results 1 to 4 of 4

populating and sorting values in a dynamic array and returning for a combobox

  1. #1
    Forum Contributor
    Join Date
    06-02-2005
    Posts
    100

    populating and sorting values in a dynamic array and returning for a combobox

    Hello,

    I have 2 columns of data, say 100 names in col 1 and an activity state (0, 1) in col 2.

    What I want to do is pick up any record name that is active (1), insert into an array (that can change size as names are added), alpha-sort that array, and then make those values in the array available as the dropdown inside of a combobox.

    Normally, I'd approach this without using an array and use a temporary sheet to move over the active names, use the excel alpha sort, then pick up the resultant cells into the combobox. This works, but is inelegant and it's time for me to learn how to use arrays properly. Any help would be most appreciated.

    My typical procedure:

    Please Login or Register  to view this content.
    I can't help but think that using arrays would be a lot cleaner. Especially when the lists grow into 10s of thousands of rows and the lag time in looping thru & moving records starts being measured in minutes...
    Last edited by Ouka; 09-30-2014 at 01:42 AM. Reason: solved

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: populating and sorting values in a dynamic array and returning for a combobox

    Hi Ouka,

    Your code looks pretty good - maybe:

    Please Login or Register  to view this content.
    Last edited by xladept; 09-24-2014 at 06:18 PM. Reason: turn off autofilter
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Contributor
    Join Date
    06-02-2005
    Posts
    100

    Re: populating and sorting values in a dynamic array and returning for a combobox

    Interesting. There's some syntax in there that I haven't used before. Ima gonna pull it apart and see what it does, thanks!

    I've been poking at arrays (never used them before, hard for me to trust that all is as it should be when I can't see them =p) and came up with the following:

    Please Login or Register  to view this content.
    I sort of understand what is going on in here; it was a lot of trial and error to get this snippet to work. Any help tightening it up would be appreciated. i also can't figure out why the top value in the combobox dropdown is a blank.
    Last edited by Ouka; 09-24-2014 at 10:11 PM.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: populating and sorting values in a dynamic array and returning for a combobox

    Hi Ouka,

    you don't need all that f.r.

    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. Populating an ActiveX combobox from a dynamic list
    By Mel_GC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-23-2014, 11:10 AM
  2. [SOLVED] Populating ComboBox using dynamic named range - Error
    By TC1980 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-16-2014, 05:42 AM
  3. Populating combobox values
    By highlystrung in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2011, 02:44 AM
  4. Sorting and Populating Combobox in Excel. HELP Please.
    By eocampo81 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-27-2009, 05:51 PM
  5. Populating an array from a range, to populate a combobox.
    By spyrule in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 11-07-2006, 07:00 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