|
使用字典法!- Dim X As Integer, Y As Integer, i As String
- Dim d1 As New Dictionary
- Dim d2 As New Dictionary
- Dim d3 As New Dictionary
- Dim d4 As New Dictionary
- Dim d5 As New Dictionary
- Dim d6 As New Dictionary
- X = Sheets("产量").Range("A65536").End(xlUp).Row
- For Y = 3 To X
- d1(Cells(Y, 1).Text) = ""
- d2(Cells(Y, 3).Text) = ""
- d3(Cells(Y, 4).Text) = ""
- d4(Cells(Y, 5).Text) = ""
- d5(Cells(Y, 6).Text) = ""
- d6(Cells(Y, 7).Text) = ""
- Next Y
- ComboBox4.List = IIf(d1.Count > 0, d1.Keys, Array(""))
- ComboBox5.List = IIf(d2.Count > 0, d2.Keys, Array(""))
- ComboBox6.List = IIf(d3.Count > 0, d3.Keys, Array(""))
- ComboBox7.List = IIf(d4.Count > 0, d4.Keys, Array(""))
- ComboBox8.List = IIf(d5.Count > 0, d5.Keys, Array(""))
- ComboBox9.List = IIf(d6.Count > 0, d6.Keys, Array(""))
- End Sub
复制代码 |
|