working with combobox: Set default value with Macro

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Another way to accomplish something similar to this is to use the subset editor when creating the combo box.
    On the main page, select the Dimension as the source of your data.
    Next click on the "Picklist" tab. Check "Activate this filter".
    Under Behaviour, select Front
    Next, go to the Dimension Contents and click Edit and select the Element you want as the default.
    You'll notice in the preview, that this element is now at the top of the list.

    It should be the default now.

    Let me know if that works for you...
  • I stumbled across this thread on the lookout for a different problem and want to add a hint if your "given value" is not static.
    In my case, I wanted the current month to be on top and selected.

    I came up with the same solution, but was confronted with the issue that the worksheet opens with the value for the combobox that it was stored with in the file-manager.
    This is not done via index, but via elementname. Thus, if my "given value" switches to the next month, it would still give me the currentmonth I last saved the worksheet.

    to avoid that, setup a macro to be executed at workbook opening

    function __open() {
    define_variable(<Period>, ActiveWorkbook()->names->item('<Currentdate>')->value);

    Period beeing the variable, Currentdate the named Formula to calculate the currentdate