|
- Sub test1()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("开票信息")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:h" & r)
- End With
- For i = 1 To UBound(arr)
- If Not d.exists(arr(i, 1)) Then
- Set d(arr(i, 1)) = CreateObject("scripting.dictionary")
- End If
- d(arr(i, 1))(i) = Empty
- Next
- ReDim brr(1 To d.Count, 1 To 29)
- m = 0
- For Each aa In d.keys
- m = m + 1
- n = d(aa).keys()(0)
- brr(m, 1) = m
- brr(m, 2) = "普通发票"
- brr(m, 4) = "是"
-
- brr(m, 6) = arr(n, 3)
- s = 0
- For Each bb In d(aa).keys
- s = s + arr(bb, 6)
- Next
- brr(m, 16) = "贸易方式:一般贸易" & vbLf & "币别:美元" & vbLf & "原币金额:" & s & vbLf & "汇率:" & arr(n, 7) & vbLf & "报关编号:" & arr(n, 2) & vbLf & "订单编号:" & arr(n, 1)
- Next
- With Worksheets("发票基本信息")
- .Range("a4").Resize(UBound(brr), UBound(brr, 2)) = brr
- End With
-
- End Sub
复制代码 |
|