+ Reply to Thread
Results 1 to 9 of 9

Reusing a list of options on a form

Hybrid View

  1. #1
    Registered User
    Join Date
    01-13-2007
    Posts
    13
    Hi

    Option 3 looks like the best option as it is working from a named worksheet (ListData)
    It comes back with 'Run-Time Error 1004' - 'Unable to get the OLEObjects property of the worksheet class'
    I have looked in a number of places including the MS site and can't seem to resolve this
    Do you have any thoughts?
    Code attached - note your version is currently commented (See UserForm_Initialize - See here section)

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    11-29-2003
    Posts
    1,203
    Well ... that explains it. I (for some reason) thought that the combo box was on a worksheet.

    Since it is on a form ... well ... combo boxes on forms do not have ListFillRanges. I put in this code and it seemed to work:

    Dim rng As Range
        Set rng = ThisWorkbook.Sheets("ListData").Range("A2:A12")
        With Me.cmbDivision
            For Each c In rng.Cells
             .AddItem c.Text
            Next c
        End With

  3. #3
    Registered User
    Join Date
    01-13-2007
    Posts
    13
    Fantastic, thanks for that

  4. #4
    Forum Contributor
    Join Date
    11-29-2003
    Posts
    1,203
    You're welcome. But, I must admit, I was only partly correct. I was reminded today that when the combo box is on a form, you can still tie it directly to a range in the workbook. Instead of being called the ListFillRange, it is called the RowSource. Different name, but acts exactly the same.

    So, if you are still reading this thread, try this:
    With Me.cmbDivision
        .RowSource = "ListData!A2:A15"
    End With

+ 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