+ Reply to Thread
Results 1 to 6 of 6

Populate Userform Combobox From Separate Workbook

  1. #1
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Question Populate Userform Combobox From Separate Workbook

    Can somee one tell me how to populate a combobox from a Defined List named Surname on worksheet called EmployeeDetails on a worksheet in a separate workbook named Defined Names List.xls

    I have tried to enter the following in the Userform Combobox Properties Row Source

    ['Defined Name List.xls]EmployeeDetails'!$b$2:$b$50 but it doesn't like it

    This is the Combobox code

    Private Sub cboSurname_Click()
    Dim Rw As Long
    With Worksheets("EmployeeDetails")
    Rw = .Range("B2:B50").Find(Me.cboSurname.Value, LookIn:=xlValues, _
    lookat:=xlWhole, MatchCase:=False).Row
    Me.txtFirstName.Text = .Range("A" & Rw).Value
    Me.txtHourlyRate.Text = Format(.Range("c" & Rw).Value, "$#,##0.00")
    End With
    End Sub


    Can someone point me in the right direction

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Populate Userform Combobox From Separate Workbook

    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
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Populate Userform Combobox From Separate Workbook

    Populate Userform Combobox From Separate Workbook

    --------------------------------------------------------------------------------

    Can somee one tell me how to populate a combobox from a Defined List named Surname on worksheet called EmployeeDetails on a worksheet in a separate workbook named Defined Names List.xls

    I have tried to enter the following in the Userform Combobox Properties Row Source

    ['Defined Name List.xls]EmployeeDetails'!$b$2:$b$50 but it doesn't like it

    This is the Combobox code

    Please Login or Register  to view this content.
    Can someone point me in the right

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Populate Userform Combobox From Separate Workbook

    Hello Mooseman60,

    Thanks for adding the code tags. I am not sure I follow your logic with using Find. A UserForm ComboBox performs look-ahead matching as you type and if the list is linked to a Range then why do you need Find? You should post your workbook so we can follow what you want to do and offer you meaningful solutions instead of educated guesses.

  5. #5
    Forum Contributor
    Join Date
    09-26-2010
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    182

    Re: Populate Userform Combobox From Separate Workbook

    Leith

    What someone has suggested is that i should have separate files 1 xla for the userform code 1 xls for the Defined names and individual .xls files for saved as job number. (Each job number is saved as an .xls file) I think what the idea is is that the userform is only a shell for looking up the data and saving it as a new workbook I have attached my workbooks

    Mooseman60
    Attached Files Attached Files

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,985

    Re: Populate Userform Combobox From Separate Workbook

    I would keep the form and the defined names in the same workbook. You can't use a Rowsource that refers to another workbook as far as I know, but I wouldn't use it anyway - I would load the data into the combobox using the List property instead.
    Everyone who confuses correlation and causation ends up dead.

+ 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