Closed Thread
Results 1 to 9 of 9

Create combobox list from autofiltered range without advance filter.

  1. #1
    Registered User
    Join Date
    06-23-2008
    Posts
    14

    Create combobox list from autofiltered range without advance filter.

    Hello everyone. I've been using previous posts here for some time now to help in my daily VBA problems. Now I have one of my own, and any help would be terrific.

    I have a combo box that I would like add items too from an autofiltered worksheet. I understand this means I can't use .RowSource. At the same time, the workbook will be shared so I can't use AdvancedFilter as well. Is there a way to search for only visible items on an autofiltered worksheet and add them to the combobox?

    Here is my current code, though it doesn't seem to work:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Try changing
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Are you on sheet1 when you raise the form and try to fill the combobox?

    rylo

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Hi,

    Try the following 4 lines of code in place of your first 3 lines of code

    Please Login or Register  to view this content.
    HTH

  4. #4
    Registered User
    Join Date
    06-23-2008
    Posts
    14
    Thanks for your help thus far:

    I've tried both of your solutions now with little luck.

    The line
    Please Login or Register  to view this content.
    Produces an error:
    "Runtime Error 91: Object variable or with type variable not set."

    Any ideas? Btw, I'm using Excel 2003 for this application.

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Struggling somewhat since it works OK for me.
    Please check:
    1. You have a filtered list of rows in col A on the VBA sheet name Sheet1
    2. You have declared the rRowSource variable as a Range variable.

    HTH

  6. #6
    Registered User
    Join Date
    06-23-2008
    Posts
    14
    Well I figured out what was wrong. I did not have the command "set" In my script. Now it appears I'm stuck in an infinite loop with the rest of the code though. Back to the drawing board! I appreciate your help!

  7. #7
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    Note: This is cross posted at ozgrid.

    http://www.ozgrid.com/forum/showthread.php?t=95363
    Reafidy.

    Tip: When using code and disabling events/screen updates/calculation be sure to use an error handler to turn them back on if an error occurs.

  8. #8
    Registered User
    Join Date
    06-23-2008
    Posts
    14
    Just wanted to clear things up a bit:

    This thread was NOT crossposted at Ozgrid. I only posted at Ozgrid AFTER seeking help here. You guys have been a great source of information to me, but my code is still hanging and I didn't want to clutter the thread up with more questions. I did not get the opportunity to even really explain what was going on before some internet bullies felt the need to cancel my account there. If you don't condone such behavior as seeking help on multiple sites then I apologize.

  9. #9
    Forum Contributor
    Join Date
    12-12-2006
    Location
    New Zealand
    Posts
    151
    You hav'nt cleared anything up.

    If you don't condone such behavior as seeking help on multiple sites then I apologize.
    Maybe if you actually read the rules regarding cross-posting you would understand. That statement above tells me you havnt.

    It doesnt matter wether you posted elsewhere before or after its still crossposting if you dont provide a link.

    I recommend you read this page for a fair explanation:

    http://www.excelguru.ca/node/7

    As for the internet bullies at ozgrid, well you were asked to read the rules and PM a mod when you understand and agree to them. Your thread would then have been unlocked and you could continue posting. Whats the problem with that, a bit sensitive arent we? Dont forget your the one asking strangers for free help.

Closed 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