步骤如下:
Sheet1的A1:A10中有如下内容
插入窗体,并插入一个复选框
双击窗体,添加如下代码
按F5执行代码,结果如下:
看下图:
代码如下,方便你复制粘贴:
Private Sub UserForm_Initialize()
Dim i As Integer
For i = 1 To 10
ComboBox1.AddItem Sheets("sheet1").Range("a" & i)
Next i
End Sub
方法:
Private Sub UserForm_Initialize()
Dim i As Integer
For i = 1 To 10
ComboBox1.AddItem Sheets("sheet1").Range("a" & i)
Next i
End Sub