I don't wish to pass a variable. I want to pass a literal value as if it's a variable during the call.
Unless there's a better way...
I want different listboxes to each use the same macro getting different results.
***Ultimately, the macro needs to know which listbox called it.***
My deal is that I'm tackling that old chestnut, “Have a listbox change subsequent listboxes”. So many people ask about this kind of thing that it should be a built in feature.
But of everything that I've looked up and read, I understand none of it. I've seen no code examples.
So I cooked up my own scheme. It works, but only for a single list box so far.
That's because the address of the table is hard-coded into the macro (“Sheet2.F1”).
If I can have any listbox (standard listbox control so far) pass a value of *its particular table to use* to the macro when called, I can have it work like I want.
I've cobbled a demo of what I'm doing. Best to say I'm using this more simply than in the demo, but I need it to be more... portable and reusable.
An explanation of the demo sheet:
• List box “lbKeyChoice” calls a macro called “ListBoxKey”. This currently seeks a table (orange on Sheet2) which uses a scheme to tell the macro which ranges to put into what other list boxes.
• It's flexible to a point (list boxes must not skip beginning entries in the lists). The list box “lists”(yellow on Sheet2) can be anywhere, but are organized here for clarity.
• The orange table lists ranges according to the (current) two choices of the key list box. This can be simply extended with more data downward to change more sub-list boxes.
• The number of key list box choices can be extended to the right more columns if wanted. Just increase the choice of the key listbox to add “Average” and make a new column of ranges.
• Then make new lists for the sub-listboxes off to the right of the yellow lists already there. Or just use a smaller part of the existing lists.
• The left column in the orange table lists the names of sub-listboxes to change.
• The choice columns are just ranges for their lists. If a range is preceded by a number, that number become the default choice of the sub listbox. If there is no number, the default is the first choice.
• Examples also show that sub-listboxes can use the same lists, just more or less of it according to the choice. “Timepiece”, “Social” and “Recreation” are examples of this.
• Ignore the list stuff in magenta. That's just to give the demo something to do. It's really all about having the macro know which listbox called it, so it knows which range table (orange) to use.
I don't see a way to save as ODF. Do you mean ODS? I hope so. That's what I'm sending.
And no, I'm not really making lists to compute social status based on wealth. That was done for entertainment value. Programmers need to laugh too.
Finally, thank you so much for answering me. I'm trying hard to learn this programming environment, and have taken a week just to get this far.