+ Reply to Thread
Results 1 to 11 of 11

How can I populate the combobox from cells in an xl sheet

  1. #1
    Registered User
    Join Date
    06-09-2008
    Posts
    28

    How can I populate the combobox from cells in an xl sheet

    I have successfully used the course booking form as a base for an input form in an accounting workbook that has several pages. (Thanks to Roy and others for the info; the course booking form on http://www.exceltip.com/st/Create_Us...Excel/629.html is the best explained piece I have found on the net)

    What I would like to do is use a range of cells to populate the combobox so that a user can make a choice from the account descriptions (from a sheet named Intro, b63:99) and have the form return the account number (Intro, a63:a99) to the relevant cell elsewhere in the workbook. The user would then have meaningful descriptions rather than numbers to choose from.

    My coding for the form thus far is as follows.


    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.


    Please Login or Register  to view this content.
    Can anyone guide me on how to do this, please?

    I use Excel X for Mac (rowsource is not an option)
    Last edited by VBA Noob; 06-10-2008 at 03:11 PM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    upod,

    Welcome to the forum.

    Your thread has being moved to it's own post and your code has being wrapped. Please follow the forum rules below before posting again

    Many thanks

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    06-09-2008
    Posts
    28

    A solution is found

    After spending much time looking for solutions, I posted the request for help yesterday. Today I managed to get the code below to work. Guidance notes have been left in;
    Please Login or Register  to view this content.
    As noted in the code I would like to refer to the cells by a pre-defined name so that the code does not need to be rewritten should the source data cell range change.

    Many thanks
    upod

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    In one of my ccount programs I have a ListBox hat displays 3 Columns-Code number, Category, Sub Category. The list of codes is stored in a hidden sheet named AccCodes in a named range called cost codes consisting of 3 Columns of data. The listbox is loaded by one line of code;
    Please Login or Register  to view this content.
    The entry to the data sheet is made to Columns corresponding for each column of the ListBox

    Please Login or Register  to view this content.
    Hope that helps.

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

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    06-09-2008
    Posts
    28

    Thanks

    Thanks RoyUK

    Will give it a try ; as mentioned in my original post, rowsource is an issue on the mac platform. My xl help warns that it is not supported on Mac but am not sure if that just means there is nothing in the properties tables. (This demonstrates how little I understand vb)

    uPod

  6. #6
    Registered User
    Join Date
    06-09-2008
    Posts
    28
    RoyUK

    I tried your suggestion but it gives me a run time error '380'. It seems the rowsource property is the problems as it is this line in the code which is highlighted in the debugger.

    If you didn't have rowsource, how would you re-code the line;
    Please Login or Register  to view this content.
    Note; I changed the sheet/range references for my project.

    Thanks
    uPod

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I didn't see that line, there doesn't seem to be an alternative.

  8. #8
    Registered User
    Join Date
    06-09-2008
    Posts
    28

    Thanks

    Thanks RoyUK

    Frustrating as it is at least your suggestions have demonstrated that I shall need to re-write the code when my accounts list area changes.

    If anyone has any other suggestions please let me know.

    Thanks
    uPod

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    maybe you could load it from a text file (*.txt)

  10. #10
    Registered User
    Join Date
    03-18-2005
    Posts
    5
    This code will fill a combo box named cboProgram with values from a Named Range "Programs" from the worksheet "LookupLists". I usually place it in the UserForm Initialize Module.



    Please Login or Register  to view this content.
    Not sure if it will work on Mac.

    hth

  11. #11
    Registered User
    Join Date
    06-09-2008
    Posts
    28

    A solution is found in the absence of rowsource (Mac)

    With a bit of help from everyone here and some external references that i can no longer find, with a bit of tweaking here and there I have found the following code to work.
    Please Login or Register  to view this content.
    Thanks to you all

+ 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