|
- Sub tet()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("sheet1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:d" & r)
- For i = 1 To UBound(arr)
- If Not d.exists(arr(i, 1)) Then
- Set d(arr(i, 1)) = CreateObject("scripting.dictionary")
- End If
- If Not d(arr(i, 1)).exists(arr(i, 2)) Then
- Set d(arr(i, 1))(arr(i, 2)) = CreateObject("scripting.dictionary")
- End If
- If Not d(arr(i, 1))(arr(i, 2)).exists(arr(i, 3)) Then
- m = 1
- ReDim brr(1 To m)
- Else
- brr = d(arr(i, 1))(arr(i, 2))(arr(i, 3))
- m = UBound(brr) + 1
- ReDim Preserve brr(1 To m)
- End If
- brr(m) = arr(i, 4)
- d(arr(i, 1))(arr(i, 2))(arr(i, 3)) = brr
- Next
- End With
- With Worksheets("sheet2")
- .UsedRange.Offset(1, 0).Clear
- m = 1
- For Each aa In d.keys
- m = m + 1
- ss = "您的订单发货快递为:"
- For Each bb In d(aa).keys
- ss = ss & "订单号" & bb & ","
- For Each cc In d(aa)(bb).keys
- ss = ss & cc & ":"
- brr = d(aa)(bb)(cc)
- For j = 1 To UBound(brr)
- ss = ss & IIf(j <> 1, "、", "") & brr(j)
- Next
- ss = ss & ";"
- Next
- Next
- .Cells(m, 1) = aa
- .Cells(m, 2) = ss
- Next
- End With
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|