+ Reply to Thread
Results 1 to 5 of 5

Populating a combobox from a table - How much is too much?

  1. #1
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    589

    Populating a combobox from a table - How much is too much?

    I do not know if i have reasonable reason to be concerned about this, but i am pretty certain you folks would know-

    I have a combobox which i wish to populate with three non-contiguous columns from a table. The table, at present, has about 550 records (rows) and 36 fields (columns). Of course the data i want reside in columns 1,17 and 36...

    In similar instances i:
    1. Copy the columns to a nice empty area of a worksheet next to one another
    2. Use combobox.list = range.currentregion.value to populate the box
    3. Erase the region

    I do so because i am afraid that using the entire table and just giving widths to the columns i want will have detrimental effects on performance by overtaxing memory and/or any other resources by loading the entire table, though i notice that my present method takes a hit in terms of time to process the copy/pastes, even when i do so on a remote location of the same worksheet (as opposed to another worksheet, presuming this has any bearing whatsoever). As an added note, the table can potentially grow to an unknown number of records.

    I believe (and i am embarrassed to say i have not run a time trial) that running loops and reading the data into an array would be more time consuming.

    Is there a "rule of thumb" that would guide me as to when to use my method rather than just using the entire dang table as my list source, or am i worried about something that isn't a concern (due to reasons that i certainly don't understand as of yet!)? Just as, if not more, important, is there a way to do this that perhaps i have not considered?

    Thank-You Very Much, as ALWAYS!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Populating a combobox from a table - How much is too much?

    You wouldn't need to run a loop to load the table into an array, that could be done in one go.

    If you only wanted to display certain columns from the table in the listbox you could load a second array from the first but since you wouldn't be reading from a worksheet that would be pretty fast.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

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

    Re: Populating a combobox from a table - How much is too much?

    Maybe this might help.
    Please Login or Register  to view this content.
    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.

  4. #4
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    589

    Re: Populating a combobox from a table - How much is too much?

    Thank-You!

    In that i have learned over time and prior outstanding assistance to trust the advice of Norie and bakerman2 inherently, i infer that loading an entire table of this size as a combobox listsource is not a good idea, and that i really need to consider revising my other instances of copying over columns and then using the copied columns as my listsource, then deleting them, over to the array methods as shown above.

    Very much appreciated! I am looking forward to experimenting with both methods.

    Best Regards,
    -Bruce(mc777)

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

    Re: Populating a combobox from a table - How much is too much?

    Thanks for feedback and kind words.

    As always you're welcome and thanks for rep+.

+ 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. Replies: 3
    Last Post: 03-22-2018, 11:25 AM
  2. populating combobox based on another combobox selection
    By bqheng in forum Word Programming / VBA / Macros
    Replies: 7
    Last Post: 08-24-2015, 08:52 AM
  3. Populating Combobox based on Combobox selection from EXCEL worksheet
    By JChaney17 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-04-2014, 08:14 AM
  4. Populating Userform ComboBox Using Items from Content Control Combobox
    By anarxo in forum Word Programming / VBA / Macros
    Replies: 2
    Last Post: 01-17-2014, 01:00 PM
  5. Populating combobox 2 with items that match criteria from combobox 1
    By kuraitori in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-13-2013, 03:00 AM
  6. Removing Duplicates from ComboBox and Populating one combobox based on another
    By kbmtech in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2010, 11:17 PM
  7. Populating the list in a combobox based off the value chosen in another combobox
    By Mervil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2010, 11:50 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