+ Reply to Thread
Results 1 to 4 of 4

Filling Comboboxes with a loop from a dynamic range

  1. #1
    Forum Contributor
    Join Date
    06-12-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    167

    Filling Comboboxes with a loop from a dynamic range

    Hello,

    I am trying to do something similar to this thread:

    HTML Code: 
    with a userform. I have 30 comboboxes that all will have the same options to pick from so I would like to fill them with a loop. I also, if possible would like the range to be able to change if I have the list expand from user input. If both are not possible I can make it work without the dynamic list.

    Right now this is what I have:

    All of the comboboxes names start as "PMEmployeePT" and then a number.

    The error I get is: Could not set the list property. Invalid property array index (I also get similar things if I try rowsource)

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Filling Comboboxes with a loop from a dynamic range

    This line:
    Please Login or Register  to view this content.
    will not return a range, but the last row with data in the a column (more or less)...
    I presume you are trying to set EmployeeTitle as the range A3 to the last row with data in col A?
    However that would not work either I think. What you are best off doing is to set the RowSource property of the comboboxes, and they are assigned a range as a string, not with a range object, so give this a go:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Filling Comboboxes with a loop from a dynamic range

    Although not really sure what kind of data is in fsrform.PMEmployees...
    Try change to
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    06-12-2017
    Location
    USA
    MS-Off Ver
    2010
    Posts
    167

    Re: Filling Comboboxes with a loop from a dynamic range

    Thank you to both I was able to use arkadi's method to do exactly what I am looking to do however if I change my form to not initialize every time I open it I will most likely switch to yours jindon.

    Thanks both were a huge help.

+ 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] Loop through a dynamic range.
    By Sluggoslabang in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 09-06-2016, 02:41 PM
  2. [SOLVED] Dynamic range in a loop
    By trailonu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2015, 07:22 PM
  3. For loop crashes Excel when filling a cell range with string value
    By icyrius in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-04-2013, 09:41 AM
  4. Loop with dynamic range
    By mthomas in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-22-2011, 10:35 PM
  5. Filling a list box with a dynamic named range
    By Alicita in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 02-01-2011, 04:12 PM
  6. Huge dependant comboboxes question (unique value population, dynamic range etc.)
    By kuraitori in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2008, 08:39 PM
  7. [SOLVED] Filling ComboBoxes
    By Tyrell in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-08-2006, 06:55 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