I have a ComboBox whose list refers to a named range that creates a dynamic list based on the matches with the linked text to the ComboBox (linked with a cell). The list has the length of the amount of matches, The ComboBox has a ComboBox_Change to refresh it.
Now my issue is, I can't Ctrl+Z anything in the document and it makes it pretty hard to work with. I used to also have an issue of the list trigerrin with any change in the worksheet, but that seems to have stopped since I changed the named range "zone" to it's sheet instead of the whole Excel (even in it's own sheet strangely). The cells used in the named range do refer to another sheet.
I had seen a link yesterday where someone mentionned it happens because every change refreshes the box, and the list should be "cached" as an array (Why is a (Excel VBA) combobox change event triggering every time one of its properties is referenced?). How would I go about doing this given that my list length keeps changing, and I can't ctrl+shift+enter 500 cells at once (would that even work?)?
Here are some codes and formulas. I freelance translated from French so there might be formula typos. Say Sheet1 is where my ComboBox is.
Cell formula used to populate named list (not really relevant I believe)
=IFERROR(INDEX(Sheet2!$H$2:$H$501;MATCH(ROWS(Sheet1!$B$1:B1);Sheet1!$B$1:$B$503;0));"")
My ComboBox VBA is as follow :
Private Sub ComboBox1_Change()
ComboBox1.ListFillRange = "DropDownList"
Me.ComboBox1.DropDown
Range("H1").Value = 1
End Sub
The Range("H1") is irrelevant for this, it is to reset a count so that my "Next" and "Previous" picture looking buttons resets.
Named range (dynamic length), where A gives me 1/0 partial match with my "search" in the ComboBox, B gives me the count of how many partial matches I get and C lists the values filling the dropdown list from the other tab.
Don't think it's helpful but here are those forumlas. No determined sheet means Sheet1.
A :
=--ISNUMBER(IFERROR(SEARCH(Sheet1!$D$1;Sheet2!H2;1);""))
B :
=IF(A1=1;SUMIF($A$1:A1;1);"")
C :
=Sheet1!$C$1:INDEX(Sheet1!$C$1:$C$503;MAX(Sheet1!$B$1:$B$503);1)
EDIT : In response to Nick, further clarification. I'm basically looking for a different way to write the macro so that it doesn't execute after every worksheet change, even those not affecting it's dynamic list. I forgot to mention in the main thread, but if my ComboBox is empty (so nothing is filtered out of columns A to C and the list is at "max capacity"), than my Undo works just fine, but as soon as there is something in the ComboBox (or the matching cell) from there on I can't use undo.