|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
按出入库类型把相应的数据写入不同数据中。刚学VBA,写了几个都不行。
比如,我先写了个销售出库的,代码如下:
Sub test2()
Dim arr, arr2(), rwcount As Long, colcount As Integer, rowsale As Long, tgtcount As Integer, j As Long
Dim shtdlv As Worksheet, x As Integer
Set shtdlv = Worksheets("delivery")
arr = shtdlv.UsedRange.Value
For rwcount = 2 To UBound(arr)
If arr(rwcount, 5) = "销售出库" Then
tgtcount = tgtcount + 1
ReDim Preserve arr2(1 To UBound(arr, 2), 1 To tgtcount)
For x = 1 To UBound(arr, 2)
arr2(x, tgtcount) = arr(rwcount, x)
Next
End If
Next
Set shtdlv = Nothing
End Sub
请大侠帮忙指点
|
|