Excel VBA: Automatic naming of ComboBoxes and their Change() procedures -


i have more 2x 200 comboboxes in worksheet

  1. how can name them example in loop like:

    comboboxa1 comboboxa200

  2. how can generate combobox_change() procedures automatically?

    private sub comboboxa 1 200_change()

    end sub

you use 1 combobox, possible in userform.if have bunch of dropdowns in each cell, use data validation, instead of comboboxes.

anyway, code can use loop through each combobox , rename it.

sub loopandrename()     dim ctrl object, x     x = 1     each ctrl in activesheet.oleobjects         if typename(ctrl.object) = "combobox"             ctrl.name = "combo" & x         end if         x = x + 1     next  end sub 

Comments