+ Reply to Thread
Results 1 to 10 of 10

Excel 2007 : How to populate combo box in vba

  1. #1
    Registered User
    Join Date
    01-14-2010
    Location
    australia
    MS-Off Ver
    Excel 2007
    Posts
    6

    How to populate combo box in vba

    Im a beginner in VBA and i am designing a form to be used at my work. I have 2 questions.

    1) i have added a combo box but cant populate the list.

    I was told to do this by a friend

    If your Combo is from the Forms toolbar then:

    Right click on you Combo and select "Format Control" then click the "Control Tab" now put you range that contains your list in the "Input range" box.


    If from the Control Toolbox:

    Right click on it and select "Properties" then Scroll down to "ListFillRange" and type your range, e.g A1:A100


    You may want to consider using Data>Validation with "List" as your allowed entries.

    Hope this helps


    but i dont have format control and in the properties list, listfillrange does not appear??? What do i do now?

    also

    2) I want to set up a txt box that automatically generates a reference number that cant be edited if the form is being filled in.

    Can you help?

    I had this on another thread that was closed and was told this by paul:

    I mean there are two type of controls Forms and active x

    active x has the format control
    Forms has the properties

    you need to select the active x Controls toolbox

    or run this
    Please Login or Register  to view this content.
    __________________
    regards pike

    But i dont have format control, i dont know how to add it and i dont know where to insert this code so it works???????

    Please help!
    Last edited by royUK; 01-15-2010 at 03:56 AM. Reason: add code tags

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: How to populate combo box in vba

    Hello bud.

    With a userform combobox you can use the rowsource proptie (select the combobox and right click propties) or you can also fill the combobox with code.
    If the items that you want to populate the combobox with are not stored on sheet. probley the eases is.
    Please Login or Register  to view this content.
    though i see that pike as posted you code that will deal with a combobox on a worksheet.
    are you dealing with a userform or a worksheet??

    with generating a reference number. using somethink like the rand function can prove not so random.
    so the best bet would be to log all the references in one column and then you will simpley add one to this for the next reference.

    can you post up a workbook, this will help with knowing the layout of your data and to see where the userform is at.

    cheers


  3. #3
    Registered User
    Join Date
    01-14-2010
    Location
    australia
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: How to populate combo box in vba

    How do i post a work book up here?

    Im using a userform. All i want is a drop down box where i can select someones name as the person that took a call. Ill show u a screenshot below. I have another question. How to i get the form to stay pop up on the excel spreadsheet so i can use it without opening vba?

    \1

  4. #4
    Registered User
    Join Date
    01-14-2010
    Location
    australia
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: How to populate combo box in vba

    Thanks for your help! Finally got my list populated!

    Also wondering how to:

    - Get the form to auto launch so that is the first thing i see when i open the workbook and have The actual sheets hidden behind it.

    - Insert a box that auto updates with today's date and also a box to create a unique reference number for every customer entered in.

    Can you help?

  5. #5
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: How to populate combo box in vba

    this will show the userform on the sheet selection. (the userform propwrity will need to be modeless)
    Please Login or Register  to view this content.
    placed in the sheet level code./

    to attach a workbook click the post and below where you type the message you can attach a file. brower attach....

    it would be much easer to help with the workbook.

    cheers

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to populate combo box in vba

    Craigelink, your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    added this time only
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Forum Contributor
    Join Date
    05-20-2008
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    176

    Re: How to populate combo box in vba

    OK,

    I have looked at this thread as well as others along the combo-box theme, tried to replicate them and failing

    I have attached a work in progress.

    On the worksheet 'Sols & Fees Data' in cells A21 through A35 are the fields I want to populate the combo-boxes in the 'CL Criteria' frame.

    What on earth am I doing wrong?
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    05-20-2008
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    176

    Re: How to populate combo box in vba

    Sorry, have just realised that this isn't in with all the other VBA queries.
    Will take it to there instead.

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to populate combo box in vba

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

  10. #10
    Forum Contributor
    Join Date
    05-20-2008
    Location
    England
    MS-Off Ver
    Office 365
    Posts
    176

    Re: How to populate combo box in vba

    My apologies, I had forgotten that rule in my excitement that someone had had such a similar experience to mine.

    Have started new thread with a new problem.

+ 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