+ Reply to Thread
Results 1 to 23 of 23

Active X Combo Box Filter Endlessly Looping

  1. #1
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Active X Combo Box Filter Endlessly Looping

    Hi!

    I'm using the following code which is resulting in an endless loop until excel crashes. It also doesn't seem to be filtering to the cmdShiftFilter value selected (1,2,3,* for all):

    Please Login or Register  to view this content.
    Thanks for the help

    M

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Active X Combo Box Filter Endlessly Looping

    How is the combobox populated?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Active X Combo Box Filter Endlessly Looping

    In the properties I set Listfillrange = ShiftList (which is my named range for the shifts list)

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Active X Combo Box Filter Endlessly Looping

    Is ShiftList on the same worksheet as the rows you are hiding?

    If it is then what could be happening is that every time you hide a row the change event is being triggered and that causes you to go into the endless loop.

  5. #5
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Active X Combo Box Filter Endlessly Looping

    No ShiftList is on a different worksheet called "Calculation Lists".

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Active X Combo Box Filter Endlessly Looping

    How is ShiftList defined?

    Also, where is the endless loop you refer to?

    As far as I can see the Do While loop in your code will be finite, stopping when the first blank cell in column 1 is found.

  7. #7
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Active X Combo Box Filter Endlessly Looping

    Just a dynamic range

    =OFFSET('Calculation Lists'!$M$2,1,0,COUNTA('Calculation Lists'!$M:$M)-1,1)

  8. #8
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Active X Combo Box Filter Endlessly Looping

    Quote Originally Posted by Norie View Post
    How is ShiftList defined?

    Also, where is the endless loop you refer to?

    As far as I can see the Do While loop in your code will be finite, stopping when the first blank cell in column 1 is found.
    When I change the value in cmbShiftFilter to 1,2,3,etc...

    The rows keep filtering down to nothing 1 by 1 until they are all hidden. Then it start over... endlessly. It doesnt actually seem to be filtering correctly to the value selected.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Active X Combo Box Filter Endlessly Looping

    That could be the problem as hiding rows could be triggering the formula to calculate which in turn could be triggering the change event again.

    Hard to tell without seeing the workbook though.

  10. #10
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Active X Combo Box Filter Endlessly Looping

    Ah, I think I understand what you are saying. Is there a way to avoid this other than changing the _Change() location? I'd like to have the change in the combobox automatically trigger the filter instead of having to click a button.

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Active X Combo Box Filter Endlessly Looping

    You could change the way the combobox is populated so that it's not 'tied' to the dynamic range.

    It would still be used for population, but there wouldn't be the 2-way link between the range and combobox.

    One way of doing that would be to use a simple line of code like this.
    Please Login or Register  to view this content.
    That could go in the activate event of the sheet the combobox is on, and could also be used elsewhere if, for whatever reason, you need to repopulate the combobox.

  12. #12
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Active X Combo Box Filter Endlessly Looping

    OK so I added

    Please Login or Register  to view this content.
    and removed ShiftList from the ListFillRange in properties but I am still getting the same issue. When I change the value in the combobox to 1,2,3.... the rows dissapear one by one (ignoring the filter rule), then they all reappear and this happens over and over. I'm thinking it has to be an issue with the function.

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Active X Combo Box Filter Endlessly Looping

    Can you upload an example workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

  14. #14
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Active X Combo Box Filter Endlessly Looping

    Please see the attached file

    demo3.xlsm

  15. #15
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Active X Combo Box Filter Endlessly Looping

    That code is not what I'm suggesting, with that you'll still have the link between the range and combobox.

    This is what I meant.
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Active X Combo Box Filter Endlessly Looping

    Using that code gives me a range of worksheet failed error.
    Last edited by SHUTTEHFACE; 12-16-2014 at 04:02 PM.

  17. #17
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Active X Combo Box Filter Endlessly Looping

    Add a worksheet reference in front of Range("ShiftList").

    By the way, I'm a little confused as the workbook you uploaded doesn't seem to have any comboboxes on the worksheets, the only ones I can find are on userforms.
    Last edited by Norie; 12-16-2014 at 04:04 PM.

  18. #18
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Active X Combo Box Filter Endlessly Looping

    There should be one in column H of the PSScheduler sheet.

  19. #19
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Active X Combo Box Filter Endlessly Looping

    Please Login or Register  to view this content.
    "Permission Denied"

  20. #20
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Active X Combo Box Filter Endlessly Looping

    Here's the code for the sheet's activate event,
    Please Login or Register  to view this content.
    and for the combobox's change event.
    Please Login or Register  to view this content.

  21. #21
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Active X Combo Box Filter Endlessly Looping

    Thanks this seems to be working a lot better as it is actually filtering but is still re-looping over and over.

  22. #22
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Active X Combo Box Filter Endlessly Looping

    That's not happening for me.

    Have you tried putting some breakpoints (F9) in the code and then stepping through with F8?

    That might help pinpoint the problem, I would look out in particular for any subs/functions that are being triggered by hiding/unhiding rows.

  23. #23
    Forum Contributor
    Join Date
    08-13-2014
    Location
    Chicago
    MS-Off Ver
    2013
    Posts
    209

    Re: Active X Combo Box Filter Endlessly Looping

    Yep it works, thanks for all your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 8
    Last Post: 12-26-2013, 02:23 PM
  2. Replies: 1
    Last Post: 12-03-2012, 08:55 AM
  3. Program appears to loop endlessly, have to force quit
    By Danexcel in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-18-2009, 12:09 PM
  4. Great Combo Filter/Search form, cant get DATE filter to integrate. HELP
    By fau5tu5 in forum Access Programming / VBA / Macros
    Replies: 4
    Last Post: 05-18-2009, 05:05 PM
  5. Looping to get combo values
    By Stuie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2007, 09:18 AM

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