使用列标题填充Excel VBAcombobox

我想填充列标题(A1到AR1)的combobox如何在Excel VBA中执行此操作?

这个代码应该做的伎俩:

 Private Sub UserForm_Initialize() Dim Cell As Range For Each Cell In Range("A1:AR1") Data_UF.CB.AddItem (Cell.Value) Next Cell End Sub 

它的function是:将每个单元格从A1循环到AR1,将其添加到用户窗体中的Combobox(CB)(Data_UF)。 这是在初始化时完成的。