+ Reply to Thread
Results 1 to 3 of 3

Populate userform combobox with a sequence of 200 numbers (i.e. 1-200)

  1. #1
    Registered User
    Join Date
    05-09-2011
    Location
    Bridgeport, Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    4

    Populate userform combobox with a sequence of 200 numbers (i.e. 1-200)

    I want to populate a combobox on a userform with a list of 200 numbers (or a variable) that are in sequence without reading or storing them in a worksheet. I would rather not use the split method in VBA and having to enter all 200 numbers in the code. Then maximum number can have four variations and while I can create four split-type array lists and use them according to other user selections, I keep thinking an an array can handle this task with a few lines of code. I did find code online that almost does the trick, except that it creates blank rows as it iterates to the maximum value of 200 instead of the actual number values:

    For i = 0 To 200
    Userform1.Combobox1.AddItem Cells(i + 1, 1).Value
    Next i

    With Userform1
    .Combobox1.BoundColumn = 0
    .Combobox1.ListIndex = 0
    .Show
    End With

    I've tried manipulating the .additem statement and searching the forum for an answer without success. It seems that most lists use either data from the worksheet or an external application.

    Your help is appreciated!

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Populate userform combobox with a sequence of 200 numbers (i.e. 1-200)

    How about?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-09-2011
    Location
    Bridgeport, Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Populate userform combobox with a sequence of 200 numbers (i.e. 1-200)

    So simple and well beyond my capabilities. Thanks SO much!

+ 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