+ Reply to Thread
Results 1 to 9 of 9

Loop Worksheet Combo Boxes

  1. #1
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Loop Worksheet Combo Boxes

    Hi all,

    I am working with some worksheet combo boxes and I am having troubles with loading values into them using a loop. The code:
    Please Login or Register  to view this content.
    Can anyone tell me why this is be so darned stubborn?

    Supashi-bo
    Last edited by Mordred; 07-25-2011 at 09:57 AM.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Loop Worksheet Combo Boxes

    Hi Mordred,
    Please Login or Register  to view this content.
    Unless your code is in the worksheet's class module, you'll also need to qualify the OLEObjects property, eg.
    Please Login or Register  to view this content.
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,001

    Re: Loop Worksheet Combo Boxes

    Assuming they are ActiveX comboboxes.
    Everyone who confuses correlation and causation ends up dead.

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Loop Worksheet Combo Boxes

    They are ActiveX comboboxes. Thanks guys, I will try this right now!

  5. #5
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Loop Worksheet Combo Boxes

    That fixed it Colin, thank you!
    Please Login or Register  to view this content.
    was the answer!
    Much appreciated!

    Michael

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Loop Worksheet Combo Boxes

    You don't need any loop.
    You'd better avoid additem to populate comboboxes/listboxes.
    Please Login or Register  to view this content.
    Last edited by snb; 07-25-2011 at 09:54 AM.



  7. #7
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Loop Worksheet Combo Boxes

    Hi snb, why avoid .AddItem? Here is the code for a combobox clear and then refill that I am troubled by:
    Please Login or Register  to view this content.
    Last edited by Mordred; 07-25-2011 at 10:16 AM.

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Loop Worksheet Combo Boxes

    Additem isn't designed for populating listboxes/comboboxes; .list is. And additem is terribly slooooooow...
    If you use .List you won't need to use .clear, because .list replaces the Listbox's whole content.
    This suffices:

    Please Login or Register  to view this content.

  9. #9
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,001

    Re: Loop Worksheet Combo Boxes

    Quote Originally Posted by snb View Post
    Additem isn't designed for populating listboxes/comboboxes
    Really? On what do you base that statement?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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