+ Reply to Thread
Results 1 to 3 of 3

Populating and Displaying Combobox in userform

Hybrid View

  1. #1
    Registered User
    Join Date
    07-24-2014
    Location
    Wisconsin
    MS-Off Ver
    2013
    Posts
    2

    Populating and Displaying Combobox in userform

    I keep getting a subscript out of range error. I am extremely new to VBA and have double checked that my combobox is indeed named TypeLabel and my Userform is named LoadType.

    Right now, I am simply trying to display a userform with a list of values from a defined range ("TestList") in the combobox. Any insight on why my code is erroring would be greatly appreciated!

    Private Sub UserForm_Initialize()

    Dim loadLabel As Range
    Dim ws As Worksheet

    Set ws = Worksheets("TestList")


    For Each loadLabel In ws.Range("TestList")
    With Me.TypeLabel
    .AddItem loadLabel.Value
    End With
    Next loadLabel

    End Sub

    Sub StartLoad()

    LoadType.Show

    End Sub


    Thank you in advance!!!

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Populating and Displaying Combobox in userform

    please Use code tags around code.
    makes things easier to read and copy

    ok your defined named range is testlist


    Private Sub UserForm_Initialize()
        Typelabel.RowSource = "testlist"
        
    End Sub
    not sure what worksheet has to do with your code

    i would avoid using label in name of controls as label is a control itself

    also just a hint to help you know what is what
    http://msdn.microsoft.com/en-au/libr...(v=vs.60).aspx
    naming conventions for controls....just helps identify things
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    07-24-2014
    Location
    Wisconsin
    MS-Off Ver
    2013
    Posts
    2

    Re: Populating and Displaying Combobox in userform

    Thank you!!

+ 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 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
  2. [SOLVED] Populating Combobox with another combox in same userform
    By DataVanMan in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 11-12-2012, 04:16 PM
  3. Userform: ComboBox Automatically Populating
    By ashleys.nl in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-14-2011, 09:43 AM
  4. Populating a userform based on a combobox selection
    By blindzero678 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2010, 03:37 PM
  5. Populating a ComboBox in a UserForm
    By I Maycotte in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2006, 01:28 PM

Tags for this Thread

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