|
- Sub 下一张发票()
- arr = Sheet1.[a1].CurrentRegion
- Set d = CreateObject("scripting.dictionary")
- For i = 2 To UBound(arr)
- buc = arr(i, 2)
- d(buc) = d(buc) & i & ","
- Next
- dk = d.keys
- With Sheet2
- buc = .[g12]
- If Not d.exists(buc) Then
- .[g12] = dk(0)
- .[g7] = "'" & Format(Date, "yyyymmdd") & "01"
- Else
- For i = 0 To UBound(dk)
- If buc = dk(i) Then
- If i < UBound(dk) Then
- .[g12] = dk(i + 1)
- Else
- MsgBox "已到最后一条记录": Exit Sub
- End If
- End If
- Next
- .[g7] = "'" & Val(.[g7]) + 1
- End If
- buc = .[g12]
- brr = Split(d(buc), ",")
- i = Val(brr(0))
- .Range("g8,g9,b12,b14,a22:f31") = ""
- .[g8] = arr(i, 7) '日期
- .[g9] = arr(i, 1) 'PO NO.
- .[b12] = arr(i, 10) ' CUST PO NO.
- .[b14] = arr(i, 8) ' SHIP VIA
- For j = 0 To UBound(brr) - 1
- If j >= 10 Then Exit For
- i = Val(brr(j))
- .Cells(22 + j, 1).Resize(1, 6) = Array(arr(i, 3), arr(i, 4), "", "", arr(i, 5), arr(i, 6))
- Next
- End With
- End Sub
- Sub 清空()
- Range("g7:g12,b12,b14,a22:f31") = ""
- End Sub
复制代码 |
|