EXCEL 的 VBA ,与VB6 稍有不同,正好这段代码里用上了这个不同的地方,
加上这个电脑没 EXCEL,年底事多。
你自己多琢磨一下吧,没时间弄了。
Dim Dic As New Dictionary Dim Brr(), K& Public Sub SubBom(ByVal keyWords$, ByVal BomList As Variant) Dim i& For i = 2 To UBound(BomList) If keyWords = BomList(i, 1) Then Dic(BomList(i, 2)) = i SubBom BomList(i, 2), BomList End If Next End Sub Public Function Bom(ByVal keyWord As Variant, ByVal BomList As Variant) Dim j&, i& For j = 1 To UBound(keyWord) Set Dic = Nothing SubBom keyWord(j, 1), BomList For i = 0 To Dic.Count - 1 ReDim Preserve Brr(K) Brr(K) = Application.Index(BomList, Dic.Items(i)) K = K + 1 Next Next Bom = Brr End Function