|
- Sub Button1_Click()
- arr = Sheet1.Range("c1:o" & Sheet1.Cells(Rows.Count, "D").End(xlUp).Row) '数据源装入数组
- Dim brr()
- For i = 5 To UBound(arr)
- 采购部门 = arr(i, 1)
- 到货日期 = arr(i, 11)
- 部门签收 = arr(i, 12)
- If 采购部门 = "总仓库" Then
- If 到货日期 <> "" And 部门签收 <> "" Then
- b = b + 1
- ReDim Preserve brr(1 To 13, 1 To b)
- brr(1, b) = "采购入库"
- brr(11, b) = arr(i, 1)
- brr(12, b) = arr(i, 12)
- brr(13, b) = arr(i, 13)
- For j = 2 To 10
- brr(j, b) = arr(i, j)
- Next
- End If
- End If
- Next
- ReDim temp(1 To b, 1 To 13)
- For i = 1 To b
- For j = 1 To 13
- temp(i, j) = brr(j, i)
- Next
- Next
- Sheet2.Range("C5:O" & Rows.Count).ClearContents
- Sheet2.Range("c5").Resize(UBound(temp), 13) = temp
- Sheet2.Activate
- End Sub
复制代码 |
|