这就是我想要做的事情:
Cell A1值是:Cat,Mouse,Dog
我想在userform中填充这些值的组合框,以便用户可以选择Cat,Mouse或Dog。
非常感谢任何帮助,提前致谢。
答案 0 :(得分:2)
试试这个:
Private Sub UserForm_Initialize()
Dim animals() As String
Dim i As Integer
animals() = Split(Sheet1.Range("A1"), ", ")
With UserForm1.ComboBox1
For i = 0 To Application.CountA(animals) - 1
.AddItem animals(i)
Next i
End With
End Sub