我在填充组合框时遇到问题。我用过:How to add items to a combobox in a form in excel VBA?
我还确保我的列表在该工作表上命名。我做错了什么?
这是初始化的代码
Private Sub UserForm1_Initialize()
'Import Combo Box Lists
Dim cCart As Range
Dim cLoc As Range
Dim wsz As Worksheet
Set wsz = Worksheets("Stockout Reference")
For Each cLoc In wsz.Range("Location")
With Me.Location
.AddItem cLoc.Value
End With
Next cLoc
For Each cCart In wsz.Range("CartName")
With Me.Cart
.AddItem cCart.Value
End With
Next cCart
Me.txtDate1.Value = Format(Date, "Medium Date")
End Sub
我确实有跟随此用户窗体的代码,但没有一个变量是相同的,所以我不知道这可能是一个问题。