Sorry, this is not helping your situation...
but maybe you can tweak the code to meet your situation.
The condition as follow :
1. rgHeader is the range of the header - rgX is the range one row below the rgHeader
2. there are OptionButtons in the userform as follow
OptionButton1
OptionButton2
OptionButton3
.... until
OptionButton20
3. then the code loop to only the existing value of "x" in the range of rgX and get the name of the column of the header above the "x" (the nm variable),
4. then loop to each existing control
4. if the control is OptionButton and if the caption is "OptionButton(i)"
5. then it change the "OptionButton(i)" caption to variable nm value, then jump to the outside loop
6. finally the other loop is to hide the rest of the OptionButton which caption has a text "OptionButton".
FYI, there must be NONE [OptionButton with the caption has a text "OptionButton"] which is not meant for the header.
As I'm not an expert and limited in English language,
maybe this is not what you want.
BTW, another way is not using OptionButton, but a ComboBox.
The ComboBox will get the item as many as there are the "X" under the row of the columns header.
So there is no "hiding" process.
Or create the OptionButton at run time, user form initialize.
Bookmarks