|
我想把入库单的所有信息通过数组一次性添加到入库明细表中,现在是入库单的单据部分实现了这个功能,抬头项的怎么做呀?没有思路了,求教!下面是我写的添加"B7:M36"部分的代码
Sub test1()
Dim MyArray, D_arr()
Dim x, y, m, k As Integer
Dim iCount As Integer
iCount = Sheet6.[F65536].End(xlUp).row
With Sheet5 '入库单
MyArray = .Range("B7:M36")
m = Application.CountIf(.Range("B7:B36"), "<>")
ReDim D_arr(1 To m, 1 To UBound(MyArray, 2))
For x = 1 To UBound(MyArray)
If Len(Trim(MyArray(x, 1))) > 0 Then
k = k + 1
For y = 1 To UBound(MyArray, 2)
D_arr(k, y) = MyArray(x, y)
Next y
End If
Next x
End With
Sheet6.Range("F" & iCount + 1).Resize(k, y - 3) = D_arr()
Erase MyArray
Erase D_arr()
End Sub
|
|