NO Question: howto make ListBoxEntries dynamic

This is an Example how to switch ListEntries for Listboxes
depentend from selected Item in other Boxes.
it derived from this this crumpy thread

with credits to @Villeroy increase Combobox-ListEntrySource

from import NamedValue

def update_other(button):
    triggert by Event: 'Modified' of Listbox_button
    search for the Named_Range addressed by actually selected Item,
    and updates 'other_button's ListEntrySource to the name_range…RangeAddress
    with credits to @ Villeroy:"
    OTHERBUTTON = "List Box 2"
    control = button.Source
    item = control.SelectedItem    
    controls = control.Model.Parent
    doc = controls.Parent.Parent
    named_ranges = doc.NamedRanges
    name_range = named_ranges.getByName(item)
    name_val = NamedValue()
    name_val.Name = "CellRange"
    name_val.Value = name_range.ReferredCells.RangeAddress
    list_source = doc.createInstance("")
    for chield in controls:
        if chield.Name == OTHERBUTTON:
1 Like